iliaa           Sun Feb 22 17:54:50 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/zip    php_zip.c 
  Log:
  
  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.1.2.38.2.27&r2=1.1.2.38.2.28&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.1.2.38.2.27 
php-src/ext/zip/php_zip.c:1.1.2.38.2.28
--- php-src/ext/zip/php_zip.c:1.1.2.38.2.27     Fri Jan  2 00:35:02 2009
+++ php-src/ext/zip/php_zip.c   Sun Feb 22 17:54:50 2009
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_zip.c,v 1.1.2.38.2.27 2009/01/02 00:35:02 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.1.2.38.2.28 2009/02/22 17:54:50 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -792,7 +792,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);
                        }
@@ -915,10 +915,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) {
@@ -926,8 +927,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);
@@ -2671,7 +2673,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.1.2.38.2.27 2009/01/02 00:35:02 pajoye Exp $");
+       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 
1.1.2.38.2.28 2009/02/22 17:54:50 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