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
This commit is contained in:
Mark Johnston 2019-09-01 21:20:31 +00:00
parent 9ae631858e
commit c993b95329

View File

@ -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) {