Handle Android libc returning NULL pw->pw_passwd

Reported by Luke Dashjr
This commit is contained in:
Damien Miller 2021-05-17 09:40:23 +10:00
parent 5953c14300
commit be2866d620
1 changed files with 1 additions and 1 deletions

2
misc.c
View File

@ -445,7 +445,7 @@ pwcopy(struct passwd *pw)
struct passwd *copy = xcalloc(1, sizeof(*copy));
copy->pw_name = xstrdup(pw->pw_name);
copy->pw_passwd = xstrdup(pw->pw_passwd);
copy->pw_passwd = xstrdup(pw->pw_passwd == NULL ? "*" : pw->pw_passwd);
#ifdef HAVE_STRUCT_PASSWD_PW_GECOS
copy->pw_gecos = xstrdup(pw->pw_gecos);
#endif