pajoye          Sat May 19 22:26:32 2007 UTC

  Modified files:              
    /php-src/ext/zip    php_zip.c 
  Log:
  - MFB:
   - Fixed a possible crash in the event directory cannot be created, due to a
     double free. (Ilia)
   - Use the same tests for zip_stat
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.43&r2=1.44&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.43 php-src/ext/zip/php_zip.c:1.44
--- php-src/ext/zip/php_zip.c:1.43      Wed Mar 14 16:34:56 2007
+++ php-src/ext/zip/php_zip.c   Sat May 19 22:26:32 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_zip.c,v 1.43 2007/03/14 16:34:56 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.44 2007/05/19 22:26:32 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -62,7 +62,7 @@
                php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as 
entry name"); \
                RETURN_FALSE; \
        } \
-       if (zip_stat(za, path, flags, &sb)) { \
+       if (zip_stat(za, path, flags, &sb) == -1) { \
                RETURN_FALSE; \
        }
 /* }}} */
@@ -103,7 +103,7 @@
        size_t file_basename_len;
        int is_dir_only = 0;
 
-       if (file_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb)) {
+       if (file_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
                return 0;
        }
 
@@ -1200,6 +1200,8 @@
        long flags = 0;
        struct zip_stat sb;
 
+       int res = 0;
+
        if (!this) {
                RETURN_FALSE;
        }
@@ -1210,6 +1212,10 @@
                        &name, &name_len, UG(ascii_conv), &flags) == FAILURE) {
                return;
        }
+       res =zip_stat(intern, name, flags, &sb);
+       if (res == -1) {
+               RETURN_FALSE;
+       }
 
        PHP_ZIP_STAT_PATH(intern, name, name_len, flags, sb);
 
@@ -1770,14 +1776,13 @@
                RETURN_FALSE;
        }
 
-       if (pathto_len<1) {
+       if (pathto_len < 1) {
                RETURN_FALSE;
        }
 
     if (php_stream_stat_path(pathto, &ssb) < 0) {
         ret = php_stream_mkdir(pathto, 0777,  PHP_STREAM_MKDIR_RECURSIVE, 
NULL);
         if (!ret) {
-            efree(pathto);
             RETURN_FALSE;
         }
     }
@@ -1800,7 +1805,7 @@
                                        RETURN_FALSE;
                                }
 
-                               if (!php_zip_extract_file(intern, pathto, file, 
file_len TSRMLS_CC)) {
+                               if (!php_zip_extract_file(intern, pathto, 
Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) {
                                        efree(file);
                                        RETURN_FALSE;
                                }
@@ -1831,7 +1836,6 @@
                                                                }
 
                                                                if 
(!php_zip_extract_file(intern, pathto, file, file_len TSRMLS_CC)) {
-                                                                       
efree(file);
                                                                        
RETURN_FALSE;
                                                                }
                                                                break;
@@ -1854,7 +1858,7 @@
         }
 
         for (i = 0; i < filecount; i++) {
-            file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+            char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
             if (!php_zip_extract_file(intern, pathto, file, strlen(file) 
TSRMLS_CC)) {
                 RETURN_FALSE;
             }
@@ -1969,7 +1973,7 @@
                return;
        }
 
-       if (zip_stat(intern, filename, 0, &sb)) {
+       if (zip_stat(intern, filename, 0, &sb) != 0) {
                RETURN_FALSE;
        }
 
@@ -2112,7 +2116,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.43 
2007/03/14 16:34:56 pajoye Exp $");
+       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.44 
2007/05/19 22:26:32 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

Reply via email to