]> git.ipfire.org Git - thirdparty/util-linux.git/commit - lib/cpuset.c
taskset: fix cpuset list parser
authorKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2019 12:12:25 +0000 (13:12 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2019 12:12:25 +0000 (13:12 +0100)
commit65bcbf105bfc5f6510b8df8db09d9458f942c799
tree37845ed501bba2e920aaaadc955842cf06c7fa21
parent06c141a99a059088a85f256d6e4096ca49874926
taskset: fix cpuset list parser

taskset hangs when executed with badly formatted cpuset list, for
example:

 $ taskset -c 0--1 true

The current cpuset list parser is pretty weak as based on scanf()
without strings verification ("-1" as input for "%u" returns
unexpected number). It seems faster and better to use strtoul() and
isdigit().

Addresses: https://github.com/karelzak/util-linux/issues/77
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/cpuset.c