Date: Sun, 1 Sep 2019 21:20:31 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351671 - head/usr.bin/cpuset Message-ID: <201909012120.x81LKVoA081469@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sun Sep 1 21:20:31 2019 New Revision: 351671 URL: https://svnweb.freebsd.org/changeset/base/351671 Log: Fix an off-by-one bug in the CPU and domain ID parser. The "size" parameter is the size of the corresponding bit set, so the maximum CPU or domain index is size - 1. MFC after: 1 week Modified: head/usr.bin/cpuset/cpuset.c Modified: head/usr.bin/cpuset/cpuset.c ============================================================================== --- head/usr.bin/cpuset/cpuset.c Sun Sep 1 19:13:20 2019 (r351670) +++ head/usr.bin/cpuset/cpuset.c Sun Sep 1 21:20:31 2019 (r351671) @@ -100,10 +100,10 @@ parselist(char *list, struct bitset *mask, int size) for (l = list; *l != '\0';) { if (isdigit(*l)) { curnum = atoi(l); - if (curnum > size) + if (curnum >= size) errx(EXIT_FAILURE, "List entry %d exceeds maximum of %d", - curnum, size); + curnum, size - 1); while (isdigit(*l)) l++; switch (state) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909012120.x81LKVoA081469>