svn commit: r313647 - head/usr.sbin/pciconf
Conrad Meyer
cem at FreeBSD.org
Sat Feb 11 18:04:45 UTC 2017
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);
More information about the svn-src-all
mailing list