Skip to content

Commit db70a33

Browse files
committed
fix thread safety and zeroing method
1 parent 2aa9db5 commit db70a33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/php_crypt_r.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
318318
*/
319319
char * php_md5_crypt_r(const char *pw, const char *salt, char *out)
320320
{
321-
static char passwd[MD5_HASH_MAX_LEN], *p;
321+
ZEND_TLS char passwd[MD5_HASH_MAX_LEN], *p;
322322
const char *sp, *ep;
323323
unsigned char final[16];
324324
unsigned int i, sl, pwl;
@@ -418,7 +418,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out)
418418
*p = '\0';
419419

420420
/* Don't leave anything around in vm they could use. */
421-
memset(final, 0, sizeof(final));
421+
ZEND_SECURE_ZERO(final, sizeof(final));
422422
return (passwd);
423423
}
424424

0 commit comments

Comments
 (0)