]> granicus.if.org Git - php/commitdiff
Fixed bug #61124 (Crash when decoding an invalid base64 encoded string).
authorScott MacVicar <scottmac@php.net>
Thu, 23 Feb 2012 01:26:46 +0000 (01:26 +0000)
committerScott MacVicar <scottmac@php.net>
Thu, 23 Feb 2012 01:26:46 +0000 (01:26 +0000)
ext/openssl/openssl.c

index f117df6ba8a5a11fd349a56f921e1ed4ef3ee33d..7c5afc55d73e8e4deb60587e0823cf3548aade3e 100644 (file)
@@ -4776,6 +4776,10 @@ PHP_FUNCTION(openssl_decrypt)
 
        if (!raw_input) {
                base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len);
+               if (!base64_str) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to base64 decode the input");
+                       RETURN_FALSE;
+               }
                data_len = base64_str_len;
                data = base64_str;
        }