com php-src: Fix incorrect outbuf freeing: ext/openssl/openssl.c

From: Date: Fri, 08 Feb 2019 11:59:48 +0000
Subject: com php-src: Fix incorrect outbuf freeing: ext/openssl/openssl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-104486@lists.php.net to get a copy of this message
Commit: c0ce258b539af2fb75517373e5c297fb84b80daa Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 8 Feb 2019 12:59:48 +0100 Parents: 0d4471fd28eea7974b5af7832958e62e546927f6 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c0ce258b539af2fb75517373e5c297fb84b80daa Log: Fix incorrect outbuf freeing Changed paths: M ext/openssl/openssl.c Diff: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 942733f..f6555b4 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -6674,10 +6674,7 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len, ch &iv, &iv_len, &free_iv, NULL, tag_len, options, 1) == FAILURE || php_openssl_cipher_update(cipher_type, cipher_ctx, &mode, &outbuf, &outlen, data, data_len, aad, aad_len, 1) == FAILURE) { - if (outbuf) - zend_string_release_ex(outbuf, 0); outbuf = NULL; - goto cleanup; } else if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + outlen, &i)) { outlen += i; if (options & OPENSSL_RAW_DATA) { @@ -6718,7 +6715,6 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len, ch outbuf = NULL; } -cleanup: if (free_password) { efree(password); } @@ -6799,10 +6795,7 @@ PHP_OPENSSL_API zend_string* php_openssl_decrypt(char *data, size_t data_len, ch &iv, &iv_len, &free_iv, tag, tag_len, options, 0) == FAILURE || php_openssl_cipher_update(cipher_type, cipher_ctx, &mode, &outbuf, &outlen, data, data_len, aad, aad_len, 0) == FAILURE) { - if (outbuf) - zend_string_release_ex(outbuf, 0); outbuf = NULL; - goto cleanup; } else if (mode.is_single_run_aead || EVP_DecryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + outlen, &i)) { outlen += i; @@ -6814,7 +6807,6 @@ PHP_OPENSSL_API zend_string* php_openssl_decrypt(char *data, size_t data_len, ch outbuf = NULL; } -cleanup: if (free_password) { efree(password); }

« previous php.cvs (#104486) next »