From be2866d6207b090615ff083c9ef212b603816a56 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 17 May 2021 09:40:23 +1000 Subject: [PATCH] Handle Android libc returning NULL pw->pw_passwd Reported by Luke Dashjr --- misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc.c b/misc.c index b0ece2442..36f26ccb6 100644 --- 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