Эх сурвалжийг харах

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>
Tuomas Tynkkynen 10 жил өмнө
parent
commit
0ece6b50f1
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      common/cmd_pxe.c

+ 1 - 1
common/cmd_pxe.c

@@ -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++;