diff options
author | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2014-08-06 14:51:40 +0400 |
---|---|---|
committer | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2014-08-06 16:07:17 +0400 |
commit | 53723338858772a0189aa3f92f4d4bbdaa9b6772 (patch) | |
tree | 590e74dbdbffec576d6f18efa719ffc4bb5e337a /adb | |
parent | 936a236b9e00100c915cce7e2fea8f553f491c7e (diff) | |
download | system_core-53723338858772a0189aa3f92f4d4bbdaa9b6772.zip system_core-53723338858772a0189aa3f92f4d4bbdaa9b6772.tar.gz system_core-53723338858772a0189aa3f92f4d4bbdaa9b6772.tar.bz2 |
Fix build of adb with gcc-4.9.
Without this patch we get:
system/core/adb/commandline.c:1629:16: error: array subscript is above
array bounds [-Werror=array-bounds]
Change-Id: I494eb8b4d0e8082f8ff57bdd33d8d46c8c481c6f
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
Diffstat (limited to 'adb')
-rw-r--r-- | adb/commandline.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/adb/commandline.c b/adb/commandline.c index 1ba6049..cb5e75d 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -1607,9 +1607,10 @@ top: return 1; } +#define MAX_ARGV_LENGTH 16 static int do_cmd(transport_type ttype, char* serial, char *cmd, ...) { - char *argv[16]; + char *argv[MAX_ARGV_LENGTH]; int argc; va_list ap; @@ -1626,7 +1627,9 @@ static int do_cmd(transport_type ttype, char* serial, char *cmd, ...) } argv[argc++] = cmd; - while((argv[argc] = va_arg(ap, char*)) != 0) argc++; + while(argc < MAX_ARGV_LENGTH && + (argv[argc] = va_arg(ap, char*)) != 0) argc++; + assert(argc < MAX_ARGV_LENGTH); va_end(ap); #if 0 |