Blob Blame History Raw

https://bugzilla.redhat.com/show_bug.cgi?id=819650

http://svn.apache.org/viewvc?view=revision&revision=1346875

--- apr-util-1.4.1/crypto/apr_md5.c.r1346875
+++ apr-util-1.4.1/crypto/apr_md5.c
@@ -721,6 +721,9 @@ APU_DECLARE(apr_status_t) apr_password_v
         CRYPTD buffer;
 
         crypt_pw = crypt_r(passwd, hash, &buffer);
+        if (!crypt_pw) {
+            return APR_EMISMATCH;
+        }
         apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1);
 #elif defined(CRYPT_R_STRUCT_CRYPT_DATA)
         struct crypt_data buffer;
@@ -732,6 +735,9 @@ APU_DECLARE(apr_status_t) apr_password_v
          */
         memset(&buffer, 0, sizeof(buffer));
         crypt_pw = crypt_r(passwd, hash, &buffer);
+        if (!crypt_pw) {
+            return APR_EMISMATCH;
+        }
         apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1);
 #else
         /* Do a bit of sanity checking since we know that crypt_r()
@@ -748,6 +754,10 @@ APU_DECLARE(apr_status_t) apr_password_v
          */
         crypt_mutex_lock();
         crypt_pw = crypt(passwd, hash);
+        if (!crypt_pw) {
+            crypt_mutex_unlock();
+            return APR_EMISMATCH;
+        }
         apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1);
         crypt_mutex_unlock();
 #endif