summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-07-28 21:06:10 +0200
committerAnatol Belski <ab@php.net>2015-07-29 10:36:28 +0200
commit7104d88c357b03b8082b29bdf66b72e276defc43 (patch)
treefb2b40ef31cc211509f6185fe64859fcf400eab0
parent7d41afeee86f46cba04a57ce3733dea58af6f5cb (diff)
downloadphp-git-7104d88c357b03b8082b29bdf66b72e276defc43.tar.gz
fix thread safety
-rw-r--r--ext/standard/crypt_sha256.c4
-rw-r--r--ext/standard/crypt_sha512.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c
index d79d14510a..38c285942e 100644
--- a/ext/standard/crypt_sha256.c
+++ b/ext/standard/crypt_sha256.c
@@ -596,8 +596,8 @@ char * php_sha256_crypt(const char *key, const char *salt)
password. We can compute an upper bound for the size of the
result in advance and so we can prepare the buffer we pass to
`sha256_crypt_r'. */
- static char *buffer;
- static int buflen;
+ ZEND_TLS char *buffer;
+ ZEND_TLS int buflen = 0;
int needed = (sizeof(sha256_salt_prefix) - 1
+ sizeof(sha256_rounds_prefix) + 9 + 1
+ (int)strlen(salt) + 1 + 43 + 1);
diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c
index df5f3d109e..3cef9a3437 100644
--- a/ext/standard/crypt_sha512.c
+++ b/ext/standard/crypt_sha512.c
@@ -643,8 +643,8 @@ php_sha512_crypt(const char *key, const char *salt) {
password. We can compute an upper bound for the size of the
result in advance and so we can prepare the buffer we pass to
`sha512_crypt_r'. */
- static char *buffer;
- static int buflen;
+ ZEND_TLS char *buffer;
+ ZEND_TLS int buflen = 0;
int needed = (int)(sizeof(sha512_salt_prefix) - 1
+ sizeof(sha512_rounds_prefix) + 9 + 1
+ strlen(salt) + 1 + 86 + 1);