From owner-svn-src-head@freebsd.org Sat Feb 11 18:04:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D659CD83D7; Sat, 11 Feb 2017 18:04:45 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D15011FEC; Sat, 11 Feb 2017 18:04:44 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1BI4hni096547; Sat, 11 Feb 2017 18:04:43 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1BI4h4g096546; Sat, 11 Feb 2017 18:04:43 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201702111804.v1BI4h4g096546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 11 Feb 2017 18:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313647 - head/usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2017 18:04:45 -0000 Author: cem Date: Sat Feb 11 18:04:43 2017 New Revision: 313647 URL: https://svnweb.freebsd.org/changeset/base/313647 Log: pciconf(8): Replace an assert with errx The condition can be hit with simple user input, so it isn't an invariant. Just error out. PR: 217003 Reported by: Vladislav V. Prodan Sponsored by: Dell EMC Isilon Modified: head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Sat Feb 11 17:05:08 2017 (r313646) +++ head/usr.sbin/pciconf/pciconf.c Sat Feb 11 18:04:43 2017 (r313647) @@ -879,7 +879,8 @@ getdevice(const char *name) errx(1, "Device name is too long"); memcpy(patterns[0].pd_name, name, cp - name); patterns[0].pd_unit = strtol(cp, &cp, 10); - assert(*cp == '\0'); + if (*cp != '\0') + errx(1, "Invalid device name"); patterns[0].flags = PCI_GETCONF_MATCH_NAME | PCI_GETCONF_MATCH_UNIT; pc.num_patterns = 1; pc.pat_buf_len = sizeof(patterns);