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) {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to