check for empty parameters in askfirst
authorZefir Kurtisi <zefir.kurtisi@neratec.com>
Wed, 18 Mar 2015 15:44:48 +0000 (16:44 +0100)
committerJohn Crispin <blogic@openwrt.org>
Wed, 18 Mar 2015 18:49:59 +0000 (19:49 +0100)
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
utils/askfirst.c

index e78823caefd42b55cf606644cdda0c2132458e8f..69de76fae02ea8325bef75ee4e84f66077161838 100644 (file)
@@ -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;
 }