Ver código fonte

vqsim: Do not access unitialized argv[0]

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 6 anos atrás
pai
commit
1af23e9c2d
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      vqsim/parser.c

+ 1 - 1
vqsim/parser.c

@@ -196,7 +196,7 @@ void parse_input_command(char *rl_cmd)
 	}
 
 	/* Ignore null commands */
-	if (strlen(argv[0]) == 0) {
+	if (argc < 1 || strlen(argv[0]) == 0) {
 		free(cmd);
 		resume_kb_input(0);
 		return;