diff options
-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 2df3f09..b268ca5 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -1746,9 +1746,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; @@ -1765,7 +1766,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 |