summaryrefslogtreecommitdiff
path: root/usr.bin/cpuset
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-09-01 21:20:31 +0000
committerMark Johnston <markj@FreeBSD.org>2019-09-01 21:20:31 +0000
commitc993b953298054ed3795fc238dd1e007696dad6a (patch)
treec5e26ac2fcf6744aa731d731966ecf68cfeacb3c /usr.bin/cpuset
parent9ae631858e354dfc503e60a87df1aa94de4479ce (diff)
downloadsrc-test-c993b953298054ed3795fc238dd1e007696dad6a.tar.gz
src-test-c993b953298054ed3795fc238dd1e007696dad6a.zip
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
Notes
Notes: svn path=/head/; revision=351671
Diffstat (limited to 'usr.bin/cpuset')
-rw-r--r--usr.bin/cpuset/cpuset.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
index c1481e2c159f0..9e3eedaa274ac 100644
--- a/usr.bin/cpuset/cpuset.c
+++ b/usr.bin/cpuset/cpuset.c
@@ -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) {