iliaa           Sun Feb 22 17:55:01 2009 UTC

  Modified files:              
    /php-src/ext/zip    php_zip.c 
  Log:
  
  MFB: Fixed 2 memory corruptions in zip extension idenfied by
  oo_properties.phpt test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.70&r2=1.71&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.70 php-src/ext/zip/php_zip.c:1.71
--- php-src/ext/zip/php_zip.c:1.70      Fri Jan  2 00:22:55 2009
+++ php-src/ext/zip/php_zip.c   Sun Feb 22 17:55:01 2009
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_zip.c,v 1.70 2009/01/02 00:22:55 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.71 2009/02/22 17:55:01 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -791,7 +791,7 @@
        switch (hnd->type) {
                case IS_STRING:
                        if (retchar) {
-                               ZVAL_STRING(*retval, (char *) retchar, 1);
+                               ZVAL_STRINGL(*retval, (char *) retchar, len, 1);
                        } else {
                                ZVAL_EMPTY_STRING(*retval);
                        }
@@ -914,10 +914,11 @@
 
        if (ret == SUCCESS) {
                zval *tmp;
+               ALLOC_INIT_ZVAL(tmp);
 
                if (type == 2) {
                        retval = 1;
-               } else if (php_zip_property_reader(obj, hnd, &tmp, 1 TSRMLS_CC) 
== SUCCESS) {
+               } else if (php_zip_property_reader(obj, hnd, &tmp, 0 TSRMLS_CC) 
== SUCCESS) {
                        Z_SET_REFCOUNT_P(tmp, 1);
                        Z_UNSET_ISREF_P(tmp);
                        if (type == 1) {
@@ -925,8 +926,9 @@
                        } else if (type == 0) {
                                retval = (Z_TYPE_P(tmp) != IS_NULL);
                        }
-                       zval_ptr_dtor(&tmp);
                }
+
+               zval_ptr_dtor(&tmp);
        } else {
                std_hnd = zend_get_std_object_handlers();
                retval = std_hnd->has_property(object, member, type TSRMLS_CC);
@@ -2745,7 +2747,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.70 
2009/01/02 00:22:55 pajoye Exp $");
+       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.71 
2009/02/22 17:55:01 iliaa Exp $");
        php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
        php_info_print_table_row(2, "Libzip version", "0.9.0");
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to