From bee0167be2340d8de4bdc1ab1064ec957c85a447 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 10 Mar 2017 13:40:18 +1100 Subject: Check for NULL from malloc. Part of bz#2687, from jjelen at redhat.com. --- auth-pam.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth-pam.c b/auth-pam.c index 7d8b2926b..bc8e5e02d 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -830,6 +830,8 @@ fake_password(const char *wire_password) fatal("%s: password length too long: %zu", __func__, l); ret = malloc(l + 1); + if (ret == NULL) + return NULL; for (i = 0; i < l; i++) ret[i] = junk[i % (sizeof(junk) - 1)]; ret[i] = '\0'; -- cgit v1.2.3