cvs: php-src(PHP_5_0) /ext/standard array.c ZendEngine2 zend_hash.c
| From: | Dmitry Stogov | Date: | Mon, 25 Apr 2005 06:11:00 +0000 |
| Subject: | cvs: php-src(PHP_5_0) /ext/standard array.c ZendEngine2 zend_hash.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-31572@lists.php.net to get a copy of this message | ||
dmitry Mon Apr 25 02:11:00 2005 EDT
Modified files: (Branch: PHP_5_0)
/ZendEngine2 zend_hash.c
/php-src/ext/standard array.c
Log:
Fixed call to estrndup() with invalid lengt
http://cvs.php.net/diff.php/ZendEngine2/zend_hash.c?r1=1.115&r2=1.115.2.1&ty=u
Index: ZendEngine2/zend_hash.c
diff -u ZendEngine2/zend_hash.c:1.115 ZendEngine2/zend_hash.c:1.115.2.1
--- ZendEngine2/zend_hash.c:1.115 Sat Jul 10 03:45:49 2004
+++ ZendEngine2/zend_hash.c Mon Apr 25 02:11:00 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_hash.c,v 1.115 2004/07/10 07:45:49 andi Exp $ */
+/* $Id: zend_hash.c,v 1.115.2.1 2005/04/25 06:11:00 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;
}
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.266.2.16&r2=1.266.2.17&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.266.2.16 php-src/ext/standard/array.c:1.266.2.17
--- php-src/ext/standard/array.c:1.266.2.16 Tue Apr 12 10:01:06 2005
+++ php-src/ext/standard/array.c Mon Apr 25 02:11:00 2005
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.266.2.16 2005/04/12 14:01:06 tony2001 Exp $ */
+/* $Id: array.c,v 1.266.2.17 2005/04/25 06:11:00 dmitry Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -669,7 +669,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 {
@@ -677,7 +677,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 {
@@ -2715,7 +2715,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