Date: Wed, 3 Dec 2014 19:44:24 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275466 - stable/9/usr.sbin/pciconf Message-ID: <201412031944.sB3JiOPI070567@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Wed Dec 3 19:44:24 2014 New Revision: 275466 URL: https://svnweb.freebsd.org/changeset/base/275466 Log: MFC r273488: Fix some bugs in the error handling of getdevice(). PR: 194506 Modified: stable/9/usr.sbin/pciconf/pciconf.c Directory Properties: stable/9/usr.sbin/pciconf/ (props changed) Modified: stable/9/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/9/usr.sbin/pciconf/pciconf.c Wed Dec 3 19:44:22 2014 (r275465) +++ stable/9/usr.sbin/pciconf/pciconf.c Wed Dec 3 19:44:24 2014 (r275466) @@ -661,16 +661,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');
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412031944.sB3JiOPI070567>