From: Scott MacVicar Date: Sun, 18 Dec 2011 05:14:32 +0000 (+0000) Subject: Fix segfault in older versions of OpenSSL (before 0.9.8i) X-Git-Tag: php-5.5.0alpha1~700 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61f3d36ac16a092cade99691bf3a16b2532468c7;p=php Fix segfault in older versions of OpenSSL (before 0.9.8i) --- diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 075dafefe4..dc27716d63 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -4736,7 +4736,9 @@ PHP_FUNCTION(openssl_encrypt) if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } - EVP_EncryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); + if (data_len > 0) { + EVP_EncryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); + } outlen = i; if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { outlen += i;