pxe: Fix crash if 'sysboot' is run without args
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>
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 4cbb2b1..abf0941 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -1648,7 +1648,7 @@
is_pxe = false;
- if (strstr(argv[1], "-p")) {
+ if (argc > 1 && strstr(argv[1], "-p")) {
prompt = 1;
argc--;
argv++;