]> granicus.if.org Git - linux-pam/commitdiff
pam_unix: check for NULL return from malloc()
authorTomas Mraz <tmraz@fedoraproject.org>
Thu, 19 Jun 2014 11:43:26 +0000 (13:43 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Thu, 19 Jun 2014 11:43:26 +0000 (13:43 +0200)
* modules/pam_unix/md5_crypt.c (crypt_md5): Check for NULL return from malloc().

modules/pam_unix/md5_crypt.c

index 53972fccefcbaf80f4fcc92c321a16c04b8679d0..4ab9ec84fc18b484241c5b0bab129e49b705a7ca 100644 (file)
@@ -51,6 +51,8 @@ char *MD5Name(crypt_md5)(const char *pw, const char *salt)
        /* TODO: now that we're using malloc'ed memory, get rid of the
           strange constant buffer size. */
        passwd = malloc(120);
+       if (passwd == NULL)
+               return NULL;
 
        /* If it starts with the magic string, then skip that */
        if (!strncmp(sp, magic, strlen(magic)))