lib,cpuset: fix stride handling in cpulist_parse()
If cpulist_parse() gets passed a cpu list with a stride value of 0 it will be stuck in an endless loop. E.g. the following cpu list will cause an endless loop: "0-2:0". Fix this by causing a parse error if the stride value is 0. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
parent
289127f52d
commit
72232a267a
|
@ -292,6 +292,8 @@ int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize, int fail)
|
|||
if (c1 != NULL && (c2 == NULL || c1 < c2)) {
|
||||
if (sscanf(c1, "%u", &s) < 1)
|
||||
return 1;
|
||||
if (s == 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue