]> granicus.if.org Git - procps-ng/commitdiff
library: tweak that change to 'supgrps_from_supgids()'
authorJim Warner <james.warner@comcast.net>
Fri, 1 Jun 2018 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Thu, 7 Jun 2018 11:35:59 +0000 (21:35 +1000)
It's good that those Qualys folks were looking over my
shoulder. They suggested a change to that commit shown
below. This improvement was obviously a better choice.

Reference(s):
. original change
commit f9a8009e27d47a61096ff7bf1de37a90f0f801e6

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

index ea7a31bb95122a1751982c4154412f90ec21d95d..a6666cbca9ca7c68887b70f8f9b140d0779da651 100644 (file)
@@ -475,11 +475,7 @@ static void supgrps_from_supgids (proc_t *p) {
 
         while (',' == *s) ++s;
         gid = strtol(s, &end, 10);
-        if (end <= s) {
-            if (!p->supgrp)
-                p->supgrp = xstrdup("-");
-            break;
-        }
+        if (end <= s) break;
         s = end;
         g = pwcache_get_group(gid);
 
@@ -491,6 +487,9 @@ static void supgrps_from_supgids (proc_t *p) {
         else if (len >= max) len = max-1;
         t += len;
     } while (*s);
+
+    if (!p->supgrp)
+        p->supgrp = xstrdup("-");
 }
 
 ///////////////////////////////////////////////////////////////////////