* src/groupmems.c (whoami): Make sure usr and grp are not NULL
before dereferencing them.
This commit is contained in:
parent
5a0715fd6c
commit
d6f96fa07e
@ -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>
|
2008-07-27 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/groupmems.c: Use xstrdup() rather than strdup().
|
* src/groupmems.c: Use xstrdup() rather than strdup().
|
||||||
|
@ -85,7 +85,9 @@ static char *whoami (void)
|
|||||||
/* local, no need for xgetpwuid */
|
/* local, no need for xgetpwuid */
|
||||||
struct passwd *usr = getpwuid (getuid ());
|
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);
|
return xstrdup (usr->pw_name);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user