svn commit: r278827 - head/usr.sbin/binmiscctl

Sean Bruno sbruno at FreeBSD.org
Sun Feb 15 23:58:58 UTC 2015


Author: sbruno
Date: Sun Feb 15 23:58:57 2015
New Revision: 278827
URL: https://svnweb.freebsd.org/changeset/base/278827

Log:
  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

Modified:
  head/usr.sbin/binmiscctl/binmiscctl.c

Modified: head/usr.sbin/binmiscctl/binmiscctl.c
==============================================================================
--- head/usr.sbin/binmiscctl/binmiscctl.c	Sun Feb 15 22:38:00 2015	(r278826)
+++ head/usr.sbin/binmiscctl/binmiscctl.c	Sun Feb 15 23:58:57 2015	(r278827)
@@ -371,8 +371,10 @@ add_cmd(__unused int argc, char *argv[],
 }
 
 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);


More information about the svn-src-head mailing list