From: Anatol Belski Date: Fri, 23 Jun 2017 22:18:57 +0000 (+0200) Subject: Fix bug #74798 pkcs7_en/decrypt does not work if \x0a is used in content X-Git-Tag: php-7.2.0alpha3~43^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b714309056cb97c52cf5d859b4ada9b8f5715b27;p=php Fix bug #74798 pkcs7_en/decrypt does not work if \x0a is used in content The patch for bug #74720 was incomplete. --- diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 47bafaf660..cbb2d3a78b 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -5387,12 +5387,12 @@ PHP_FUNCTION(openssl_pkcs7_decrypt) goto clean_exit; } - in = BIO_new_file(infilename, "r"); + in = BIO_new_file(infilename, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY)); if (in == NULL) { php_openssl_store_errors(); goto clean_exit; } - out = BIO_new_file(outfilename, "w"); + out = BIO_new_file(outfilename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY)); if (out == NULL) { php_openssl_store_errors(); goto clean_exit; diff --git a/ext/openssl/tests/bug74798.phpt b/ext/openssl/tests/bug74798.phpt new file mode 100644 index 0000000000..5b41af3efc --- /dev/null +++ b/ext/openssl/tests/bug74798.phpt @@ -0,0 +1,96 @@ +--TEST-- +Bug #74798 pkcs7_en/decrypt does not work if \x0a is used in content +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +int(40) +int(40) +int(40) +string(80) "537472696e672077697468200a2077696c6c20656e6420696e206f6e652062797465206d6f72652e" +string(80) "537472696e672077697468200a2077696c6c20656e6420696e206f6e652062797465206d6f72652e" +===DONE===