pajoye Tue Oct 31 19:03:57 2006 UTC
Modified files:
/php-src/ext/zip php_zip.c
/php-src/ext/zip/tests oo_stream.phpt
Log:
- fix possible leak in addFile when an unicode filename is given
- Mark getStream as Unicode ready, the tests was wrong
$unistring .= fread($fpbinary); $unistring remains as unicode.
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.23&r2=1.24&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.23 php-src/ext/zip/php_zip.c:1.24
--- php-src/ext/zip/php_zip.c:1.23 Tue Oct 31 14:27:09 2006
+++ php-src/ext/zip/php_zip.c Tue Oct 31 19:03:57 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zip.c,v 1.23 2006/10/31 14:27:09 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.24 2006/10/31 19:03:57 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -990,11 +990,18 @@
}
if(!expand_filepath(filename, resolved_path TSRMLS_CC)) {
+ if (Z_TYPE_PP(filename_zval) == IS_UNICODE) {
+ efree(entry_name);
+ }
+
RETURN_FALSE;
}
zs = zip_source_file(intern, resolved_path, 0, 0);
if (!zs) {
+ if (Z_TYPE_PP(filename_zval) == IS_UNICODE) {
+ efree(entry_name);
+ }
RETURN_FALSE;
}
@@ -1817,7 +1824,7 @@
}
/* }}} */
-/* {{{ proto resource getStream(string entryname)
+/* {{{ proto resource getStream(string entryname) U
get a stream for an entry using its name */
ZIPARCHIVE_METHOD(getStream)
{
@@ -1986,7 +1993,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "Zip", "enabled");
- php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.23
2006/10/31 14:27:09 pajoye Exp $");
+ php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.24
2006/10/31 19:03:57 pajoye Exp $");
php_info_print_table_row(2, "Zip version", "2.0.0");
php_info_print_table_row(2, "Libzip version", "0.7.1");
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/oo_stream.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/zip/tests/oo_stream.phpt
diff -u php-src/ext/zip/tests/oo_stream.phpt:1.1
php-src/ext/zip/tests/oo_stream.phpt:1.2
--- php-src/ext/zip/tests/oo_stream.phpt:1.1 Mon Oct 30 17:43:21 2006
+++ php-src/ext/zip/tests/oo_stream.phpt Tue Oct 31 19:03:57 2006
@@ -2,7 +2,7 @@
getStream
--SKIPIF--
<?php
-/* $Id: oo_stream.phpt,v 1.1 2006/10/30 17:43:21 pajoye Exp $ */
+/* $Id: oo_stream.phpt,v 1.2 2006/10/31 19:03:57 pajoye Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
@@ -18,7 +18,7 @@
var_dump($fp);
if(!$fp) exit("\n");
-$contents = '';
+$contents = b'';
while (!feof($fp)) {
$contents .= fread($fp, 255);
}
@@ -32,7 +32,7 @@
if (!$fp) {
exit("cannot open\n");
}
-$contents = '';
+$contents = b'';
while (!feof($fp)) {
$contents .= fread($fp, 2);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php