diff options
author | Heiko Carstens | 2011-09-09 11:19:32 +0200 |
---|---|---|
committer | Karel Zak | 2011-09-10 00:00:24 +0200 |
commit | 72232a267a8b021c5170419062f8ae831f18ca0e (patch) | |
tree | 8774ed6a665ab2a8e724308c6e5703f49b0f2162 | |
parent | lib,cpuset: fix odd placed braces in cpulist_parse() (diff) | |
download | kernel-qcow2-util-linux-72232a267a8b021c5170419062f8ae831f18ca0e.tar.gz kernel-qcow2-util-linux-72232a267a8b021c5170419062f8ae831f18ca0e.tar.xz kernel-qcow2-util-linux-72232a267a8b021c5170419062f8ae831f18ca0e.zip |
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>
-rw-r--r-- | lib/cpuset.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/cpuset.c b/lib/cpuset.c index cf22aa778..85927553e 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -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; } } |