cvs: ZendEngine2 / zend_hash.c php-src/ext/standard array.c

From: Date: Mon, 25 Apr 2005 06:13:58 +0000
Subject: cvs: ZendEngine2 / zend_hash.c php-src/ext/standard array.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3581@lists.php.net to get a copy of this message
dmitry Mon Apr 25 02:13:58 2005 EDT Modified files: /php-src/ext/standard array.c /ZendEngine2 zend_hash.c Log: Fixed call to estrndup() with invalid length http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.297&r2=1.298&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.297 php-src/ext/standard/array.c:1.298 --- php-src/ext/standard/array.c:1.297 Tue Apr 12 10:00:54 2005 +++ php-src/ext/standard/array.c Mon Apr 25 02:13:57 2005 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.297 2005/04/12 14:00:54 tony2001 Exp $ */ +/* $Id: array.c,v 1.298 2005/04/25 06:13:57 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -701,7 +701,7 @@ s = *((Bucket **) b); if (f->nKeyLength) { - Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength); + Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength-1); Z_STRLEN(key1) = f->nKeyLength-1; Z_TYPE(key1) = IS_STRING; } else { @@ -709,7 +709,7 @@ Z_TYPE(key1) = IS_LONG; } if (s->nKeyLength) { - Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength); + Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength-1); Z_STRLEN(key2) = s->nKeyLength-1; Z_TYPE(key2) = IS_STRING; } else { @@ -2737,7 +2737,7 @@ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL); break; case HASH_KEY_IS_STRING: - new_key=estrndup(string_key,str_key_len); + new_key=estrndup(string_key,str_key_len - 1); if (change_to_upper) php_strtoupper(new_key, str_key_len - 1); else http://cvs.php.net/diff.php/ZendEngine2/zend_hash.c?r1=1.116&r2=1.117&ty=u Index: ZendEngine2/zend_hash.c diff -u ZendEngine2/zend_hash.c:1.116 ZendEngine2/zend_hash.c:1.117 --- ZendEngine2/zend_hash.c:1.116 Thu Jul 29 15:18:46 2004 +++ ZendEngine2/zend_hash.c Mon Apr 25 02:13:57 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.116 2004/07/29 19:18:46 helly Exp $ */ +/* $Id: zend_hash.c,v 1.117 2005/04/25 06:13:57 dmitry Exp $ */ #include "zend.h" @@ -1054,7 +1054,7 @@ if (p) { if (p->nKeyLength) { if (duplicate) { - *str_index = estrndup(p->arKey, p->nKeyLength); + *str_index = estrndup(p->arKey, p->nKeyLength-1); } else { *str_index = p->arKey; }

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