newgrp: fix segmentation fault
Fix segmentation fault in newgrp when xgetspnam() returns a NULL value
that is immediately freed.
The error was committed in
e65cc6aebc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2019553
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
parent
387da46d73
commit
497e90751b
@ -163,8 +163,8 @@ static void check_perms (const struct group *grp,
|
||||
spwd = xgetspnam (pwd->pw_name);
|
||||
if (NULL != spwd) {
|
||||
pwd->pw_passwd = xstrdup (spwd->sp_pwdp);
|
||||
spw_free (spwd);
|
||||
}
|
||||
spw_free (spwd);
|
||||
|
||||
if ((pwd->pw_passwd[0] == '\0') && (grp->gr_passwd[0] != '\0')) {
|
||||
needspasswd = true;
|
||||
|
Loading…
Reference in New Issue
Block a user