tony2001 Wed Aug 30 20:50:03 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/openssl/tests 002.phpt
Modified files:
/php-src/ext/openssl openssl.c
Log:
MFH: fix segfault in openssl_seal(), add test
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.12&r2=1.98.2.5.2.13&diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.12
php-src/ext/openssl/openssl.c:1.98.2.5.2.13
--- php-src/ext/openssl/openssl.c:1.98.2.5.2.12 Fri Aug 18 13:02:37 2006
+++ php-src/ext/openssl/openssl.c Wed Aug 30 20:50:03 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: openssl.c,v 1.98.2.5.2.12 2006/08/18 13:02:37 tony2001 Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.13 2006/08/30 20:50:03 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -3183,7 +3183,9 @@
pkeys = safe_emalloc(nkeys, sizeof(*pkeys), 0);
eksl = safe_emalloc(nkeys, sizeof(*eksl), 0);
eks = safe_emalloc(nkeys, sizeof(*eks), 0);
+ memset(eks, 0, sizeof(*eks) * nkeys);
key_resources = safe_emalloc(nkeys, sizeof(long), 0);
+ memset(key_resources, 0, sizeof(*key_resources) * nkeys);
/* get the public keys we are using to seal this data */
zend_hash_internal_pointer_reset_ex(pubkeysht, &pos);
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/002.phpt?view=markup&rev=1.1
Index: php-src/ext/openssl/tests/002.phpt
+++ php-src/ext/openssl/tests/002.phpt
--TEST--
openssl_seal() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$a = 1;
$b = array(1);
$c = array(1);
$d = array(1);
var_dump(openssl_seal($a, $b, $c, $d));
var_dump(openssl_seal($a, $a, $a, array()));
var_dump(openssl_seal($c, $c, $c, 1));
var_dump(openssl_seal($b, $b, $b, ""));
echo "Done\n";
?>
--EXPECTF--
Warning: openssl_seal(): not a public key (0th member of pubkeys) in %s on line
%d
bool(false)
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty
array in %s on line %d
bool(false)
Warning: openssl_seal() expects parameter 1 to be string, array given in %s on
line %d
NULL
Warning: openssl_seal() expects parameter 1 to be string, array given in %s on
line %d
NULL
Done
--UEXPECTF--
Warning: openssl_seal(): not a public key (0th member of pubkeys) in %s on line
%d
bool(false)
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty
array in %s on line %d
bool(false)
Warning: openssl_seal() expects parameter 1 to be binary string, array given in
%s on line %d
NULL
Warning: openssl_seal() expects parameter 1 to be binary string, array given in
%s on line %d
NULL
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php