]> granicus.if.org Git - procps-ng/commit
proc/readproc.c: Harden stat2proc().
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Fri, 18 May 2018 21:32:22 +0000 (07:32 +1000)
commit344f6d3c0e0b2ff923089b5318f3a69c3d5b7f46
tree94d5c234e10b847f99812e3196f515dd9e410b96
parent20269a4129ba19d21ad85b31bd54c87ac5fef1ba
proc/readproc.c: Harden stat2proc().

1/ Use a "size_t num" instead of an "unsigned num" (also, do not store
the return value of sscanf() into num, it was unused anyway).

2/ Check the return value of strchr() and strrchr().

3/ Never jump over the terminating null byte with "S = tmp + 2".
proc/readproc.c