diff options
author | sbruno <sbruno@FreeBSD.org> | 2015-02-15 23:58:57 +0000 |
---|---|---|
committer | sbruno <sbruno@FreeBSD.org> | 2015-02-15 23:58:57 +0000 |
commit | fc82b6528cac21e8b1a720c53176ac13403431ad (patch) | |
tree | 269ddbc4758afd59da15505f1543783abc82c7b1 /usr.sbin | |
parent | 29752e34ae945d9432588a60029151aa8709f329 (diff) | |
download | FreeBSD-src-fc82b6528cac21e8b1a720c53176ac13403431ad.zip FreeBSD-src-fc82b6528cac21e8b1a720c53176ac13403431ad.tar.gz |
If no arguments are passed to a subcommand that requires arguments,
error out before we deref a null pointer in the check for max length.
Thanks to otis in IRC for the bug report.
MFC after: 3 days
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/binmiscctl/binmiscctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/binmiscctl/binmiscctl.c b/usr.sbin/binmiscctl/binmiscctl.c index 44122eb..5ab82e4 100644 --- a/usr.sbin/binmiscctl/binmiscctl.c +++ b/usr.sbin/binmiscctl/binmiscctl.c @@ -371,8 +371,10 @@ add_cmd(__unused int argc, char *argv[], ximgact_binmisc_entry_t *xbe) } int -name_cmd(__unused int argc, char *argv[], ximgact_binmisc_entry_t *xbe) +name_cmd(int argc, char *argv[], ximgact_binmisc_entry_t *xbe) { + if (argc == 0) + usage("Required argument missing\n"); if (strlen(argv[0]) > IBE_NAME_MAX) usage("'%s' string length longer than IBE_NAME_MAX (%d)", IBE_NAME_MAX); |