Skip to content

Instantly share code, notes, and snippets.

@kiyoto
Created February 18, 2012 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiyoto/1857431 to your computer and use it in GitHub Desktop.
Save kiyoto/1857431 to your computer and use it in GitHub Desktop.
openssl_decrypt bug patch
Index: ext/openssl/openssl.c
===================================================================
--- ext/openssl/openssl.c (revision 323312)
+++ ext/openssl/openssl.c (working copy)
@@ -4801,6 +4801,11 @@
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment