summaryrefslogtreecommitdiff
path: root/auth-pam.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2017-03-10 13:40:18 +1100
committerDarren Tucker <dtucker@zip.com.au>2017-03-10 13:40:18 +1100
commitbee0167be2340d8de4bdc1ab1064ec957c85a447 (patch)
tree419d549af0d1ac680a4eb598f8b1d83e30c66d2c /auth-pam.c
parentda39b09d43b137a5a3d071b51589e3efb3701238 (diff)
Check for NULL from malloc.
Part of bz#2687, from jjelen at redhat.com.
Diffstat (limited to 'auth-pam.c')
-rw-r--r--auth-pam.c2
1 files changed, 2 insertions, 0 deletions
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)
830 fatal("%s: password length too long: %zu", __func__, l); 830 fatal("%s: password length too long: %zu", __func__, l);
831 831
832 ret = malloc(l + 1); 832 ret = malloc(l + 1);
833 if (ret == NULL)
834 return NULL;
833 for (i = 0; i < l; i++) 835 for (i = 0; i < l; i++)
834 ret[i] = junk[i % (sizeof(junk) - 1)]; 836 ret[i] = junk[i % (sizeof(junk) - 1)];
835 ret[i] = '\0'; 837 ret[i] = '\0';