mirror of
https://github.com/php/php-src.git
synced 2026-04-25 17:08:14 +02:00
Move overflow checks in openssl_pbkdf2
This commit is contained in:
@@ -4022,11 +4022,6 @@ PHP_FUNCTION(openssl_pbkdf2)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(key_length, key);
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(iterations, iterations);
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(password_len, password);
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(salt_len, salt);
|
||||
|
||||
if (method_len) {
|
||||
digest = EVP_get_digestbyname(method);
|
||||
} else {
|
||||
@@ -4038,6 +4033,11 @@ PHP_FUNCTION(openssl_pbkdf2)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(key_length, key);
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(iterations, iterations);
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(password_len, password);
|
||||
PHP_OPENSSL_CHECK_OVERFLOW(salt_len, salt);
|
||||
|
||||
out_buffer = zend_string_alloc(key_length, 0);
|
||||
|
||||
if (PKCS5_PBKDF2_HMAC(password, (int)password_len, (unsigned char *)salt, (int)salt_len, (int)iterations, digest, (int)key_length, (unsigned char*)ZSTR_VAL(out_buffer)) == 1) {
|
||||
|
||||
Reference in New Issue
Block a user