]> granicus.if.org Git - procps-ng/commit
library: avoid problems involving 'supgid' mishandling
authorJim Warner <james.warner@comcast.net>
Wed, 30 May 2018 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Thu, 31 May 2018 12:02:03 +0000 (22:02 +1000)
commitf9a8009e27d47a61096ff7bf1de37a90f0f801e6
treea88ad7b69f95d3f881b7586fe3b5953f746c7aed
parent336d4ab90e56cbb793c4f6899ff392e99deb5167
library: avoid problems involving 'supgid' mishandling

Following that patch referenced below, the top SUPGRPS
field would produce a segmentation fault and ps SUPGRP
would often show "(null)". Such problems resulted from
some faulty logic in the status2proc() routine dealing
with 'Groups' (supgid) which served as a source field.

For many processes the original code produced an empty
string which prevented conversion to the expected "-".
Moreover, prior to release 3.3.15 such an empty string
will become 0 after strtol() which pwcache_get_group()
translates to 'root' yielding very misleading results.

So, now we'll check for empty '/proc/#/status/Groups:'
fields & consistently provide a "-" value for callers.

[ we'll also protect against future problems in that ]
[ new qualys logic by always ensuring valid 'supgrp' ]
[ pointers - logic which revealed our original flaw! ]

Reference(s):
. original qualys patch
0071-proc-readproc.c-Harden-supgrps_from_supgids.patch

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/readproc.c