mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Exit with usage if argv[1] is NULL in dispatch. This fixes core dumps
when a command has subcommands, but the user doesn't give the parameters on the command line. Sponsored by: Netflix
This commit is contained in:
parent
56e101b337
commit
e71bab696f
1 changed files with 5 additions and 0 deletions
|
|
@ -75,6 +75,11 @@ dispatch(int argc, char *argv[], struct nvme_function *tbl)
|
|||
{
|
||||
struct nvme_function *f = tbl;
|
||||
|
||||
if (argv[1] == NULL) {
|
||||
gen_usage(tbl);
|
||||
return;
|
||||
}
|
||||
|
||||
while (f->name != NULL) {
|
||||
if (strcmp(argv[1], f->name) == 0)
|
||||
f->fn(argc-1, &argv[1]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue