]> git.kernelconcepts.de Git - karo-tx-uboot.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)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:46:07 +0000 (22:46 +0200)
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++;