pajoye Tue Oct 31 23:25:41 2006 UTC
Modified files:
/php-src/ext/zip php_zip.c
Log:
- use zip_name_locate in getCommentName
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.25&r2=1.26&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.25 php-src/ext/zip/php_zip.c:1.26
--- php-src/ext/zip/php_zip.c:1.25 Tue Oct 31 19:34:41 2006
+++ php-src/ext/zip/php_zip.c Tue Oct 31 23:25:41 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zip.c,v 1.25 2006/10/31 19:34:41 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.26 2006/10/31 23:25:41 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1306,6 +1306,10 @@
return;
}
+ if (name_len < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as
entry name");
+ }
+
idx = zip_name_locate(intern, name, 0);
if (idx < 0) {
RETURN_FALSE;
@@ -1347,12 +1351,11 @@
{
struct zip *intern;
zval *this = getThis();
- int name_len;
+ int name_len, idx;
long flags = 0;
int comment_len = 0;
const char * comment;
char *name;
- struct zip_stat sb;
if (!this) {
RETURN_FALSE;
@@ -1365,8 +1368,17 @@
return;
}
- PHP_ZIP_STAT_PATH(intern, name, name_len, 0, sb);
- comment = zip_get_file_comment(intern, sb.index, &comment_len,
(int)flags);
+ if (name_len < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as
entry name");
+ RETURN_FALSE;
+ }
+
+ idx = zip_name_locate(intern, name, 0);
+ if (idx < 0) {
+ RETURN_FALSE;
+ }
+
+ comment = zip_get_file_comment(intern, idx, &comment_len, (int)flags);
RETURN_STRINGL((char *)comment, (long)comment_len, 1);
}
/* }}} */
@@ -2021,7 +2033,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.25
2006/10/31 19:34:41 pajoye Exp $");
+ php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.26
2006/10/31 23:25:41 pajoye Exp $");
php_info_print_table_row(2, "Zip version", "2.0.0");
php_info_print_table_row(2, "Libzip version", "0.7.1");
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php