summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Ro <yro@google.com>2020-08-18 17:13:40 -0700
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-10-13 01:07:39 +0000
commitcf9d5d571f97fdce3d100ece113694ec2cd4bd7a (patch)
treeafc6f1a310b3483d7fe9b6e467e9f979aabbb1d3
parent61b620ad4f773e86c03e0719ae24268babcc62a9 (diff)
downloadbase-cf9d5d571f97fdce3d100ece113694ec2cd4bd7a.tar.gz
Fix out of bound error of IncidentService
Before this change, it was possible for the code to suffer an out of bound error. Bug: 150706572 Test: make Change-Id: I3e8d37f2ee3c942bc9b176edee043557b005c757 (cherry picked from commit 8ff5315e989c1348e313bcb8170b77adc80b2fce) (cherry picked from commit e592700068db0335c83934f191fc9efcbd8037ec)
-rw-r--r--cmds/incidentd/src/IncidentService.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index dc1612575f38..13bf197aa9dc 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -554,6 +554,10 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8
return NO_ERROR;
}
if (!args[0].compare(String8("section"))) {
+ if (argCount == 1) {
+ fprintf(out, "Not enough arguments for section\n");
+ return NO_ERROR;
+ }
int id = atoi(args[1]);
int idx = 0;
while (SECTION_LIST[idx] != NULL) {