summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pciconf
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2014-12-03 19:44:22 +0000
committermarkj <markj@FreeBSD.org>2014-12-03 19:44:22 +0000
commitb431d8bfcf00b54b75c7998064e774897db68c97 (patch)
treee1bad4aebd2c45cfab368e08b32e8070727aa324 /usr.sbin/pciconf
parentec597a3d4ebed02aaab38affec52c269c45674fa (diff)
downloadFreeBSD-src-b431d8bfcf00b54b75c7998064e774897db68c97.zip
FreeBSD-src-b431d8bfcf00b54b75c7998064e774897db68c97.tar.gz
MFC r273488:
Fix some bugs in the error handling of getdevice(). PR: 194506
Diffstat (limited to 'usr.sbin/pciconf')
-rw-r--r--usr.sbin/pciconf/pciconf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 12e83ec..22bb61d 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -662,16 +662,16 @@ getdevice(const char *name)
* find the start of the unit.
*/
if (name[0] == '\0')
- err(1, "Empty device name");
+ errx(1, "Empty device name");
cp = strchr(name, '\0');
assert(cp != NULL && cp != name);
cp--;
while (cp != name && isdigit(cp[-1]))
cp--;
- if (cp == name)
+ if (cp == name || !isdigit(*cp))
errx(1, "Invalid device name");
if ((size_t)(cp - name) + 1 > sizeof(patterns[0].pd_name))
- errx(1, "Device name i2s too long");
+ 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');
OpenPOWER on IntegriCloud