From owner-svn-src-all@FreeBSD.ORG Sun Feb 15 23:58:58 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32024AF7; Sun, 15 Feb 2015 23:58:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C96699D; Sun, 15 Feb 2015 23:58:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1FNwvin036939; Sun, 15 Feb 2015 23:58:57 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1FNwvXa036938; Sun, 15 Feb 2015 23:58:57 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201502152358.t1FNwvXa036938@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sun, 15 Feb 2015 23:58:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278827 - head/usr.sbin/binmiscctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2015 23:58:58 -0000 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);