Browse Source

check for empty parameters in askfirst

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Zefir Kurtisi 9 years ago
parent
commit
0cf744c720
1 changed files with 6 additions and 1 deletions
  1. 6 1
      utils/askfirst.c

+ 6 - 1
utils/askfirst.c

@@ -31,8 +31,13 @@ int main(int argc, char **argv)
 	}
 	while (c != 0xA);
 
+	if (argc < 2) {
+		printf("%s needs to be called with at least 1 parameter\n", argv[0]);
+		return -1;
+	}
+
 	execvp(argv[1], &argv[1]);
-	printf("Failed to execute %s\n", argv[0]);
+	printf("Failed to execute %s\n", argv[1]);
 
 	return -1;
 }