Author: mav
Date: Thu Feb 1 19:43:51 2018
New Revision: 328724
URL: https://svnweb.freebsd.org/changeset/base/328724
Log:
MFC r314229 (by imp):
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.
Modified:
stable/11/sbin/nvmecontrol/nvmecontrol.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:43:18 2018
(r328723)
+++ stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:43:51 2018
(r328724)
@@ -75,6 +75,11 @@ dispatch(int argc, char *argv[], struct nvme_function
{
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]);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"