From: Ilia Alshanetsky Date: Thu, 30 Nov 2006 16:00:05 +0000 (+0000) Subject: MFB: Use reantrant crypt_r() whenever possible. X-Git-Tag: RELEASE_1_0_0RC1~879 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=053747b5129810d60ae7b0e45af8655384cd02ca;p=php MFB: Use reantrant crypt_r() whenever possible. --- diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 7d1eea0b76..97ff2fc04d 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -145,8 +145,15 @@ PHP_FUNCTION(crypt) salt[2] = '\0'; #endif } - - RETVAL_STRING(crypt(str, salt), 1); +#ifdef HAVE_CRYPT_R + { + struct crypt_data buffer; + memset(&buffer, 0, sizeof(buffer)); + RETURN_STRING(crypt_r(str, salt, &buffer)); + } +#else + RETURN_STRING(crypt(str, salt), 1); +#endif } /* }}} */ #endif