Skip to content

Commit 7104d88

Browse files
committed
fix thread safety
1 parent 7d41afe commit 7104d88

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/standard/crypt_sha256.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,8 @@ char * php_sha256_crypt(const char *key, const char *salt)
596596
password. We can compute an upper bound for the size of the
597597
result in advance and so we can prepare the buffer we pass to
598598
`sha256_crypt_r'. */
599-
static char *buffer;
600-
static int buflen;
599+
ZEND_TLS char *buffer;
600+
ZEND_TLS int buflen = 0;
601601
int needed = (sizeof(sha256_salt_prefix) - 1
602602
+ sizeof(sha256_rounds_prefix) + 9 + 1
603603
+ (int)strlen(salt) + 1 + 43 + 1);

ext/standard/crypt_sha512.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,8 @@ php_sha512_crypt(const char *key, const char *salt) {
643643
password. We can compute an upper bound for the size of the
644644
result in advance and so we can prepare the buffer we pass to
645645
`sha512_crypt_r'. */
646-
static char *buffer;
647-
static int buflen;
646+
ZEND_TLS char *buffer;
647+
ZEND_TLS int buflen = 0;
648648
int needed = (int)(sizeof(sha512_salt_prefix) - 1
649649
+ sizeof(sha512_rounds_prefix) + 9 + 1
650650
+ strlen(salt) + 1 + 86 + 1);

0 commit comments

Comments
 (0)