diff options
| author | Scott MacVicar <scottmac@php.net> | 2011-12-18 05:14:32 +0000 |
|---|---|---|
| committer | Scott MacVicar <scottmac@php.net> | 2011-12-18 05:14:32 +0000 |
| commit | 61f3d36ac16a092cade99691bf3a16b2532468c7 (patch) | |
| tree | 2b9352e86a5537dea652631c37d49e9d8a2bc85f | |
| parent | 525dd55eed41ce7adef1aa1ab7f55b2591f83c33 (diff) | |
| download | php-git-61f3d36ac16a092cade99691bf3a16b2532468c7.tar.gz | |
Fix segfault in older versions of OpenSSL (before 0.9.8i)
| -rw-r--r-- | ext/openssl/openssl.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |
