com php-src: fix thread safety: ext/standard/crypt_sha25 6.c ext/standard/crypt_sha512.c
| From: | Anatol Belski | Date: | Wed, 29 Jul 2015 08:36:28 +0000 |
| Subject: | com php-src: fix thread safety: ext/standard/crypt_sha25 6.c ext/standard/crypt_sha512.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88219@lists.php.net to get a copy of this message | ||
Commit: 7104d88c357b03b8082b29bdf66b72e276defc43
Author: Anatol Belski <ab@php.net> Tue, 28 Jul 2015 21:06:10 +0200
Parents: 7d41afeee86f46cba04a57ce3733dea58af6f5cb
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7104d88c357b03b8082b29bdf66b72e276defc43
Log:
fix thread safety
Changed paths:
M ext/standard/crypt_sha256.c
M ext/standard/crypt_sha512.c
Diff:
diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c
index d79d145..38c2859 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 df5f3d1..3cef9a3 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);