A patch for Bug #61124
| From: | Kiyoto Tamura | Date: | Sun, 19 Feb 2012 09:12:22 +0000 |
| Subject: | A patch for Bug #61124 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-57905@lists.php.net to get a copy of this message | ||
I propose the following patch to prevent segfault for openssl_decrypt as detailed in https://bugs.php.net/bug.php?id=61124
Index: ext/openssl/openssl.c
===================================================================
--- ext/openssl/openssl.c (revision 323312)
+++ ext/openssl/openssl.c (working copy)
@@ -4801,6 +4801,10 @@
base64_str = (char*)php_base64_decode((unsigned char*)data, data_len,
&base64_str_len);
data_len = base64_str_len;
data = base64_str;
+ if (data == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode the
base64 input");
+ RETURN_FALSE;
+ }
}
keylen = EVP_CIPHER_key_length(cipher_type);
Feedback is appreciated. Thanks!
Kiyoto