diff options
author | Elliott Hughes <enh@google.com> | 2014-08-06 17:57:38 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-08-05 00:30:25 +0000 |
commit | 29c5a78fdc163f7d5e5e3a00729b8c37a89562f6 (patch) | |
tree | b6cfb8b5ba6e810a56fc7a34597028cd5b2263ae /adb/commandline.c | |
parent | a8d0c4a2b8f99dd3dba9d726bdecde98d350da50 (diff) | |
parent | 53723338858772a0189aa3f92f4d4bbdaa9b6772 (diff) | |
download | system_core-29c5a78fdc163f7d5e5e3a00729b8c37a89562f6.zip system_core-29c5a78fdc163f7d5e5e3a00729b8c37a89562f6.tar.gz system_core-29c5a78fdc163f7d5e5e3a00729b8c37a89562f6.tar.bz2 |
Merge "Fix build of adb with gcc-4.9."
Diffstat (limited to 'adb/commandline.c')
-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 ccf158c..356c0db 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -1602,9 +1602,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; @@ -1621,7 +1622,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 |