Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 581918 Details for
Bug 818684
PATCH: properly deal with crypt() returning NULL
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch hanlding crypt() returning NULL
httpd-2.2.22-crypt.patch (text/plain), 3.06 KB, created by
Paul Wouters
on 2012-05-03 18:13:41 UTC
(
hide
)
Description:
patch hanlding crypt() returning NULL
Filename:
MIME Type:
Creator:
Paul Wouters
Created:
2012-05-03 18:13:41 UTC
Size:
3.06 KB
patch
obsolete
>diff -Naur httpd-2.2.22-orig/srclib/apr-util/crypto/apr_md5.c httpd-2.2.22/srclib/apr-util/crypto/apr_md5.c >--- httpd-2.2.22-orig/srclib/apr-util/crypto/apr_md5.c 2007-11-15 05:49:47.000000000 -0500 >+++ httpd-2.2.22/srclib/apr-util/crypto/apr_md5.c 2012-05-03 13:35:05.280002887 -0400 >@@ -721,6 +721,13 @@ > CRYPTD buffer; > > crypt_pw = crypt_r(passwd, hash, &buffer); >+ if(crypt_pw == NULL) { >+ /* >+ * crypt_r() failed, could be not properly implemented or >+ * FIPS restriction >+ */ >+ return APR_EMISMATCH >+ } > apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1); > #elif defined(CRYPT_R_STRUCT_CRYPT_DATA) > struct crypt_data buffer; >@@ -732,6 +739,9 @@ > */ > memset(&buffer, 0, sizeof(buffer)); > crypt_pw = crypt_r(passwd, hash, &buffer); >+ if(crypt_pw == NULL) { >+ 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 +758,9 @@ > */ > crypt_mutex_lock(); > crypt_pw = crypt(passwd, hash); >+ if(crypt_pw == NULL) { >+ return APR_EMISMATCH >+ } > apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1); > crypt_mutex_unlock(); > #endif >diff -Naur httpd-2.2.22-orig/support/htdbm.c httpd-2.2.22/support/htdbm.c >--- httpd-2.2.22-orig/support/htdbm.c 2009-09-14 17:00:19.000000000 -0400 >+++ httpd-2.2.22/support/htdbm.c 2012-05-03 13:28:51.808846675 -0400 >@@ -288,6 +288,7 @@ > { > char cpw[MAX_STRING_LEN]; > char salt[9]; >+ char *cbuf; > > switch (htdbm->alg) { > case ALG_APSHA: >@@ -315,7 +316,12 @@ > (void) srand((int) time((time_t *) NULL)); > to64(&salt[0], rand(), 8); > salt[8] = '\0'; >- apr_cpystrn(cpw, (char *)crypt(htdbm->userpass, salt), sizeof(cpw) - 1); >+ cbuf = crypt(htdbm->userpass, salt); >+ if(cbuf == NULL){ >+ fprintf(stderr, "crypt() failed!\n"); >+ return APR_EINVAL; >+ } >+ apr_cpystrn(cpw, cbuf, sizeof(cpw) - 1); > fprintf(stderr, "CRYPT is now deprecated, use MD5 instead!\n"); > #endif > default: >diff -Naur httpd-2.2.22-orig/support/htpasswd.c httpd-2.2.22/support/htpasswd.c >--- httpd-2.2.22-orig/support/htpasswd.c 2011-04-17 15:07:23.000000000 -0400 >+++ httpd-2.2.22/support/htpasswd.c 2012-05-03 13:26:19.358976306 -0400 >@@ -93,6 +93,7 @@ > #define ERR_OVERFLOW 5 > #define ERR_BADUSER 6 > #define ERR_INVALID 7 >+#define ERR_CRYPTFAIL 8 > > #define APHTP_NEWFILE 1 > #define APHTP_NOFILE 2 >@@ -217,8 +218,17 @@ > } > to64(&salt[0], rand(), 8); > salt[8] = '\0'; >+ char *cbuf; > >- apr_cpystrn(cpw, crypt(pw, salt), sizeof(cpw) - 1); >+ cbuf = crypt(pw, salt); >+ apr_cpystrn(record, "resultant record too long", (rlen - 1)); >+ return ERR_OVERFLOW; >+ if(cbuf == NULL){ >+ apr_cpystrn(record, "crypt() failed", (rlen - 1)); >+ return ERR_CRYPTFAIL; >+ } >+ >+ apr_cpystrn(cpw, cbuf, sizeof(cpw) - 1); > if (strlen(pw) > 8) { > char *truncpw = strdup(pw); > truncpw[8] = '\0';
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 818684
: 581918