cvs: php-src(PHP_4_3) /ext/standard array.c Zend zend_hash.c

From: Date: Mon, 25 Apr 2005 06:14:50 +0000
Subject: cvs: php-src(PHP_4_3) /ext/standard array.c Zend zend_hash.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-31573@lists.php.net to get a copy of this message
dmitry Mon Apr 25 02:14:50 2005 EDT Modified files: (Branch: PHP_4_3) /Zend zend_hash.c /php-src/ext/standard array.c Log: Fixed call to estrndup() with invalid length http://cvs.php.net/diff.php/Zend/zend_hash.c?r1=1.87.4.6&r2=1.87.4.7&ty=u Index: Zend/zend_hash.c diff -u Zend/zend_hash.c:1.87.4.6 Zend/zend_hash.c:1.87.4.7 --- Zend/zend_hash.c:1.87.4.6 Mon Jul 12 17:26:46 2004 +++ Zend/zend_hash.c Mon Apr 25 02:14:50 2005 @@ -1066,7 +1066,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; } http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.199.2.43&r2=1.199.2.44&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.199.2.43 php-src/ext/standard/array.c:1.199.2.44 --- php-src/ext/standard/array.c:1.199.2.43 Thu Mar 31 03:18:40 2005 +++ php-src/ext/standard/array.c Mon Apr 25 02:14:50 2005 @@ -22,7 +22,7 @@ */ -/* $Id: array.c,v 1.199.2.43 2005/03/31 08:18:40 sniper Exp $ */ +/* $Id: array.c,v 1.199.2.44 2005/04/25 06:14:50 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -640,7 +640,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 { @@ -648,7 +648,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 { @@ -2492,7 +2492,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

« previous php.cvs (#31573) next »