Merge pull request #437 from ikerexxe/newgrp_segfault

newgrp: fix segmentation fault
This commit is contained in:
Serge Hallyn 2021-11-17 08:18:13 -06:00 committed by GitHub
commit 126fbe57bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,8 +163,8 @@ static void check_perms (const struct group *grp,
spwd = xgetspnam (pwd->pw_name); spwd = xgetspnam (pwd->pw_name);
if (NULL != spwd) { if (NULL != spwd) {
pwd->pw_passwd = xstrdup (spwd->sp_pwdp); pwd->pw_passwd = xstrdup (spwd->sp_pwdp);
spw_free (spwd);
} }
spw_free (spwd);
if ((pwd->pw_passwd[0] == '\0') && (grp->gr_passwd[0] != '\0')) { if ((pwd->pw_passwd[0] == '\0') && (grp->gr_passwd[0] != '\0')) {
needspasswd = true; needspasswd = true;