From: nekral-guest Date: Sun, 27 Jul 2008 22:30:31 +0000 (+0000) Subject: * src/groupmems.c (whoami): Make sure usr and grp are not NULL X-Git-Tag: 4.1.3~309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6f96fa07e06b4f8d1c7e9ea5d12848aa0342bbe;p=thirdparty%2Fshadow.git * src/groupmems.c (whoami): Make sure usr and grp are not NULL before dereferencing them. --- diff --git a/ChangeLog b/ChangeLog index 871783da7..aef35493c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-27 Nicolas François + + * src/groupmems.c (whoami): Make sure usr and grp are not NULL + before dereferencing them. + 2008-07-27 Nicolas François * src/groupmems.c: Use xstrdup() rather than strdup(). diff --git a/src/groupmems.c b/src/groupmems.c index e68d68728..9a2c2c7ef 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -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;