diff options
| author | Colin Cross <ccross@android.com> | 2012-07-24 16:36:41 -0700 |
|---|---|---|
| committer | Colin Cross <ccross@android.com> | 2012-07-24 16:37:52 -0700 |
| commit | 8fb6e06ba44b92258bf44110ea5361496257e24e (patch) | |
| tree | 859cf4ccb6d954eeb62a6b4430a8ff0027c830f7 | |
| parent | f58f62eb31afb59a74566f60683cbbd1099e3111 (diff) | |
| download | system_core-8fb6e06ba44b92258bf44110ea5361496257e24e.zip system_core-8fb6e06ba44b92258bf44110ea5361496257e24e.tar.gz system_core-8fb6e06ba44b92258bf44110ea5361496257e24e.tar.bz2 | |
fastboot: check argc before using argv
"fastboot -w" would segfault because *argv was invalid when no
non-option arguments were specified. Check argc > 0 before
dereferencing argv.
Change-Id: I822a799e6a38e4e5c0a4eca48c6343b8a08a6185
| -rw-r--r-- | fastboot/fastboot.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c index ff99173..5954444 100644 --- a/fastboot/fastboot.c +++ b/fastboot/fastboot.c @@ -825,7 +825,7 @@ int main(int argc, char **argv) return 1; } - if (!strcmp(*argv, "devices")) { + if (argc > 0 && !strcmp(*argv, "devices")) { skip(1); list_devices(); return 0; |
