diff options
author | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2012-12-28 09:38:41 +0000 |
---|---|---|
committer | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2012-12-28 09:38:41 +0000 |
commit | 8ac74ccf1bf3d30a4dc2ea025244811d788c0fff (patch) | |
tree | 74a1e86f6c8ecb2d949586bab82c9f887950cd66 | |
parent | e14c44503ae0a57f05e95cc993467233334e2ac9 (diff) | |
download | libapr-8ac74ccf1bf3d30a4dc2ea025244811d788c0fff.tar.gz |
Fixup r1422413 so that memset is used on non-glibc platforms
Noticed by Alan Hourihane <alanh fairlite co uk>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1426442 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | crypto/apr_passwd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/crypto/apr_passwd.c b/crypto/apr_passwd.c index dc35c0e6a..5fcb439ed 100644 --- a/crypto/apr_passwd.c +++ b/crypto/apr_passwd.c @@ -138,16 +138,21 @@ APR_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 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) { |