com php-src: Require strict base64 in openssl_decode: ext /openssl/openssl.c
| From: | Nikita Popov | Date: | Fri, 22 Jul 2016 16:03:55 +0000 |
| Subject: | com php-src: Require strict base64 in openssl_decode: ext /openssl/openssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93328@lists.php.net to get a copy of this message | ||
Commit: f775199ac70abef4bf7fa29c805d73df09131e21
Author: Lauri Kenttä <lauri.kentta@gmail.com> Mon, 11 Jul 2016 12:40:01 +0300
Committer: Nikita Popov <nikic@php.net> Fri, 22 Jul 2016 18:03:55 +0200
Parents: 76f6f3583ce466aa5cf76d3be3deba04e4935f18
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f775199ac70abef4bf7fa29c805d73df09131e21
Log:
Require strict base64 in openssl_decode
Using invalid data in a security-related context makes no sense,
and there's even a test which depends on invalid base64 data failing,
even though it currently fails for the wrong reasons by sheer luck.
Changed paths:
M ext/openssl/openssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index e01d4a5..d41ba73 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -6375,7 +6375,7 @@ PHP_FUNCTION(openssl_decrypt)
php_openssl_load_cipher_mode(&mode, cipher_type);
if (!(options & OPENSSL_RAW_DATA)) {
- base64_str = php_base64_decode((unsigned char*)data, (int)data_len);
+ base64_str = php_base64_decode_ex((unsigned char*)data, (int)data_len, 1);
if (!base64_str) {
php_error_docref(NULL, E_WARNING, "Failed to base64 decode the input");
EVP_CIPHER_CTX_free(cipher_ctx);