diff options
author | Pierre Joye <pajoye@php.net> | 2011-02-21 10:07:31 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2011-02-21 10:07:31 +0000 |
commit | 5261861d7711e5314cf0d743428edc84bfd4c694 (patch) | |
tree | 816816931fe7ddcc56d70b94c17b2427dfb3299e /ext/openssl | |
parent | 3242016f283138486242e4c4f4c0b1a5ce2e000f (diff) | |
download | php-git-5261861d7711e5314cf0d743428edc84bfd4c694.tar.gz |
- fix bug #54060, memory leak in openssl_encrypt
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/openssl.c | 1 | ||||
-rw-r--r-- | ext/openssl/tests/bug54060.phpt | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 31158e5aa2..47deeb386e 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -4731,6 +4731,7 @@ PHP_FUNCTION(openssl_encrypt) if (free_iv) { efree(iv); } + EVP_CIPHER_CTX_cleanup(&cipher_ctx); } /* }}} */ diff --git a/ext/openssl/tests/bug54060.phpt b/ext/openssl/tests/bug54060.phpt new file mode 100644 index 0000000000..fe8ca94a5f --- /dev/null +++ b/ext/openssl/tests/bug54060.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #54060 (Memory leak in openssl_encrypt) +--SKIPIF-- +<?php if (!extension_loaded("openssl")) die("skip"); ?> +--FILE-- +<?php + +$data = "jfdslkjvflsdkjvlkfjvlkjfvlkdm,4w 043920r 9234r 32904r 09243 +r7-89437 r892374 r894372 r894 7289r7 f frwerfh i iurf iuryw uyrfouiwy ruy +972439 8478942 yrhfjkdhls"; +$pass = "r23498rui324hjbnkj"; + +openssl_encrypt($data, 'des3', $pass, false, '1qazxsw2'); +echo "Done"; +?> +--EXPECT-- +Done |