* src/groupmems.c (whoami): Make sure usr and grp are not NULL
before dereferencing them.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user