apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1426442 - /apr/apr/trunk/crypto/apr_passwd.c
Date Fri, 28 Dec 2012 09:38:41 GMT
Author: sf
Date: Fri Dec 28 09:38:41 2012
New Revision: 1426442

URL: http://svn.apache.org/viewvc?rev=1426442&view=rev
Log:
Fixup r1422413 so that memset is used on non-glibc platforms

Noticed by Alan Hourihane <alanh fairlite co uk>

Modified:
    apr/apr/trunk/crypto/apr_passwd.c

Modified: apr/apr/trunk/crypto/apr_passwd.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_passwd.c?rev=1426442&r1=1426441&r2=1426442&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_passwd.c (original)
+++ apr/apr/trunk/crypto/apr_passwd.c Fri Dec 28 09:38:41 2012
@@ -138,16 +138,21 @@ APR_DECLARE(apr_status_t) apr_password_v
         struct crypt_data buffer;
 
 #ifdef __GLIBC_PREREQ
+        /*
+         * For not too old glibc (>= 2.3.2), it's enough to set
+         * buffer.initialized = 0. For < 2.3.2 and for other platforms,
+         * we need to zero the whole struct.
+         */
 #if __GLIBC_PREREQ(2,4)
+#define USE_CRYPT_DATA_INITALIZED
+#endif
+#endif
+
+#ifdef USE_CRYPT_DATA_INITALIZED
         buffer.initialized = 0;
 #else
-        /*
-         * glibc before 2.3.2 had a bug that required clearing the
-         * whole struct
-         */
         memset(&buffer, 0, sizeof(buffer));
 #endif
-#endif /* defined __GLIBC_PREREQ */
 
         crypt_pw = crypt_r(passwd, hash, &buffer);
         if (!crypt_pw) {



Mime
View raw message