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>
This commit is contained in:
Alexander Ivchenko 2014-08-06 14:51:40 +04:00
parent 936a236b9e
commit 5372333885
1 changed files with 5 additions and 2 deletions

View File

@ -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