mirror of
https://github.com/php/php-src.git
synced 2025-08-17 22:48:57 +02:00
Fix a memory leak on openssl_decrypt()
This commit is contained in:
parent
9c812109d4
commit
d44509418e
1 changed files with 9 additions and 4 deletions
|
@ -4691,10 +4691,9 @@ PHP_FUNCTION(openssl_decrypt)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!raw_input) {
|
||||
base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len);
|
||||
data_len = base64_str_len;
|
||||
data = base64_str;
|
||||
if (!method_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
cipher_type = EVP_get_cipherbyname(method);
|
||||
|
@ -4703,6 +4702,12 @@ PHP_FUNCTION(openssl_decrypt)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!raw_input) {
|
||||
base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len);
|
||||
data_len = base64_str_len;
|
||||
data = base64_str;
|
||||
}
|
||||
|
||||
keylen = EVP_CIPHER_key_length(cipher_type);
|
||||
if (keylen > password_len) {
|
||||
key = emalloc(keylen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue