diff options
author | Mark Johnston <markj@FreeBSD.org> | 2019-09-01 21:20:31 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2019-09-01 21:20:31 +0000 |
commit | c993b953298054ed3795fc238dd1e007696dad6a (patch) | |
tree | c5e26ac2fcf6744aa731d731966ecf68cfeacb3c /usr.bin | |
parent | 9ae631858e354dfc503e60a87df1aa94de4479ce (diff) | |
download | src-c993b953298054ed3795fc238dd1e007696dad6a.tar.gz src-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')
-rw-r--r-- | usr.bin/cpuset/cpuset.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c index c1481e2c159f..9e3eedaa274a 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) { |