mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix potential use-after-scope if crypt_r is used
This commit is contained in:
parent
d579b10c84
commit
187d7f05c2
1 changed files with 4 additions and 6 deletions
|
@ -181,17 +181,15 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE))
|
# if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE))
|
||||||
{
|
|
||||||
# if defined(CRYPT_R_STRUCT_CRYPT_DATA)
|
# if defined(CRYPT_R_STRUCT_CRYPT_DATA)
|
||||||
struct crypt_data buffer;
|
struct crypt_data buffer;
|
||||||
memset(&buffer, 0, sizeof(buffer));
|
memset(&buffer, 0, sizeof(buffer));
|
||||||
# elif defined(CRYPT_R_CRYPTD)
|
# elif defined(CRYPT_R_CRYPTD)
|
||||||
CRYPTD buffer;
|
CRYPTD buffer;
|
||||||
# else
|
# else
|
||||||
# error Data struct used by crypt_r() is unknown. Please report.
|
# error Data struct used by crypt_r() is unknown. Please report.
|
||||||
# endif
|
# endif
|
||||||
crypt_res = crypt_r(password, salt, &buffer);
|
crypt_res = crypt_r(password, salt, &buffer);
|
||||||
}
|
|
||||||
# elif defined(HAVE_CRYPT)
|
# elif defined(HAVE_CRYPT)
|
||||||
crypt_res = crypt(password, salt);
|
crypt_res = crypt(password, salt);
|
||||||
# else
|
# else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue