Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2017 18:04:43 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313647 - head/usr.sbin/pciconf
Message-ID:  <201702111804.v1BI4h4g096546@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <admin at support.od.ua>
  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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702111804.v1BI4h4g096546>