cvs: ZendEngine2(PHP_5_2) / zend_ini.c php-src NEWS

From: Date: Sun, 17 Jun 2007 14:31:12 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_ini.c php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5853@lists.php.net to get a copy of this message
iliaa Sun Jun 17 14:31:12 2007 UTC Modified files: (Branch: PHP_5_2) /php-src NEWS /ZendEngine2 zend_ini.c Log: Fixed zend_alter_ini_entry() memory_limit interruption vulnerability. http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.784&r2=1.2027.2.547.2.785&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.784 php-src/NEWS:1.2027.2.547.2.785 --- php-src/NEWS:1.2027.2.547.2.784 Sun Jun 17 10:56:51 2007 +++ php-src/NEWS Sun Jun 17 14:31:11 2007 @@ -25,6 +25,8 @@ - Fixed size calculation in chunk_split(). (Stas) - Fixed integer overlow in str[c]spn(). (Stas) - Fixed money_format() not to accept multiple %i or %n tokens. (Stas, Ilia) +- Fixed zend_alter_ini_entry() memory_limit interruption vulnerability. + (Ilia) - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory already exists). (Pierre) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ini.c?r1=1.39.2.2.2.9&r2=1.39.2.2.2.10&diff_format=u Index: ZendEngine2/zend_ini.c diff -u ZendEngine2/zend_ini.c:1.39.2.2.2.9 ZendEngine2/zend_ini.c:1.39.2.2.2.10 --- ZendEngine2/zend_ini.c:1.39.2.2.2.9 Fri Jun 8 14:47:45 2007 +++ ZendEngine2/zend_ini.c Sun Jun 17 14:31:12 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.39.2.2.2.9 2007/06/08 14:47:45 tony2001 Exp $ */ +/* $Id: zend_ini.c,v 1.39.2.2.2.10 2007/06/17 14:31:12 iliaa Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -55,7 +55,9 @@ ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); } zend_end_try(); } - efree(ini_entry->value); + if (ini_entry->value != ini_entry->orig_value) { + efree(ini_entry->value); + } ini_entry->value = ini_entry->orig_value; ini_entry->value_length = ini_entry->orig_value_length; ini_entry->modified = 0; @@ -234,34 +236,39 @@ { zend_ini_entry *ini_entry; char *duplicate; + zend_bool modified; TSRMLS_FETCH(); if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } + if (stage == ZEND_INI_STAGE_ACTIVATE && modify_type == ZEND_INI_SYSTEM) { + ini_entry->modifiable = ZEND_INI_SYSTEM; + } + if (!(ini_entry->modifiable & modify_type)) { return FAILURE; } - if (stage == ZEND_INI_STAGE_ACTIVATE && modify_type == ZEND_INI_SYSTEM) { - ini_entry->modifiable = ZEND_INI_SYSTEM; + modified = ini_entry->modified; + + if (!EG(modified_ini_directives)) { + ALLOC_HASHTABLE(EG(modified_ini_directives)); + zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0); + } + if (!modified) { + ini_entry->orig_value = ini_entry->value; + ini_entry->orig_value_length = ini_entry->value_length; + ini_entry->modified = 1; + zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL); } duplicate = estrndup(new_value, new_value_length); - + if (!ini_entry->on_modify || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) { - if (!ini_entry->modified) { - ini_entry->orig_value = ini_entry->value; - ini_entry->orig_value_length = ini_entry->value_length; - ini_entry->modified = 1; - if (!EG(modified_ini_directives)) { - ALLOC_HASHTABLE(EG(modified_ini_directives)); - zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0); - } - zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL); - } else { /* we already changed the value, free the changed value */ + if (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */ efree(ini_entry->value); } ini_entry->value = duplicate;

« previous php.zend-engine.cvs (#5853) next »