diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-24 13:06:01 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-24 13:07:00 +0200 |
commit | 187d7f05c2529779006840e34cbd9de4faabb229 (patch) | |
tree | d3309ae7dabfa2caf20bece3902ee056ab2ef15b /ext/standard/crypt.c | |
parent | d579b10c84d9f6c02a09ca5d2b1448af6dcadc92 (diff) | |
download | php-git-187d7f05c2529779006840e34cbd9de4faabb229.tar.gz |
Fix potential use-after-scope if crypt_r is used
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r-- | ext/standard/crypt.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 6188dc2920..18839624d4 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -181,17 +181,15 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch #else # if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE)) - { # if defined(CRYPT_R_STRUCT_CRYPT_DATA) - struct crypt_data buffer; - memset(&buffer, 0, sizeof(buffer)); + struct crypt_data buffer; + memset(&buffer, 0, sizeof(buffer)); # elif defined(CRYPT_R_CRYPTD) - CRYPTD buffer; + CRYPTD buffer; # else # error Data struct used by crypt_r() is unknown. Please report. # endif - crypt_res = crypt_r(password, salt, &buffer); - } + crypt_res = crypt_r(password, salt, &buffer); # elif defined(HAVE_CRYPT) crypt_res = crypt(password, salt); # else |