]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pxe: Fix crash if 'sysboot' is run without args
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Thu, 7 May 2015 18:29:18 +0000 (21:29 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 27 May 2015 17:35:48 +0000 (13:35 -0400)
Previously, a NULL pointer dereference would occur if the 'sysboot'
command is executed without any arguments.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/cmd_pxe.c

index 4cbb2b11734542caf44fcc9fd1c01ec21dc26e33..abf0941b579c20ae8ca1b31ba7196921e39ffab2 100644 (file)
@@ -1648,7 +1648,7 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        is_pxe = false;
 
-       if (strstr(argv[1], "-p")) {
+       if (argc > 1 && strstr(argv[1], "-p")) {
                prompt = 1;
                argc--;
                argv++;