]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Handle Android libc returning NULL pw->pw_passwd
authorDamien Miller <djm@mindrot.org>
Sun, 16 May 2021 23:40:23 +0000 (09:40 +1000)
committerDamien Miller <djm@mindrot.org>
Sun, 16 May 2021 23:41:46 +0000 (09:41 +1000)
Reported by Luke Dashjr

misc.c

diff --git a/misc.c b/misc.c
index b0ece2442cc7de1b4dcf7b0b8265b6944f1b978a..36f26ccb6ec70f6ebdf8e076778e0325c8c4a30b 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -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