]> 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 36a61c62ff9205ddcb22ce57e083929aba8bd1fc..a48ab20d6a797f61094079a9e14286918a71042d 100644 (file)
@@ -4799,6 +4799,10 @@ PHP_FUNCTION(openssl_decrypt)
 
        if (!(options & OPENSSL_RAW_DATA)) {
                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;
        }