]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
* src/groupmems.c (whoami): Make sure usr and grp are not NULL
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 27 Jul 2008 22:30:31 +0000 (22:30 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 27 Jul 2008 22:30:31 +0000 (22:30 +0000)
before dereferencing them.

ChangeLog
src/groupmems.c

index 871783da76058523be97190b9f38bfadab3027f3..aef35493c38eb97735b6e819a63941b9123725c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-27  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/groupmems.c (whoami): Make sure usr and grp are not NULL
+       before dereferencing them.
+
 2008-07-27  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/groupmems.c: Use xstrdup() rather than strdup().
index e68d687281d3582afd388e3fd7d77c55f678da27..9a2c2c7ef1abd733926af759f7f8fd2224e5f1cf 100644 (file)
@@ -85,7 +85,9 @@ static char *whoami (void)
        /* local, no need for xgetpwuid */
        struct passwd *usr = getpwuid (getuid ());
 
-       if (0 == strcmp (usr->pw_name, grp->gr_name)) {
+       if (   (NULL != usr)
+           && (NULL != grp)
+           && (0 == strcmp (usr->pw_name, grp->gr_name))) {
                return xstrdup (usr->pw_name);
        } else {
                return NULL;