zeev Tue Jul 22 11:46:48 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/main main.c
Log:
Fix potential crash (zend_hash_get_current_key_ex() doesn't touch the string
arguments if
the key is not a string!)
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.42 php-src/main/main.c:1.512.2.43
--- php-src/main/main.c:1.512.2.42 Fri Jun 20 13:00:16 2003
+++ php-src/main/main.c Tue Jul 22 11:46:48 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.512.2.42 2003/06/20 17:00:16 iliaa Exp $ */
+/* $Id: main.c,v 1.512.2.43 2003/07/22 15:46:48 zeev Exp $ */
/* {{{ includes
*/
@@ -1337,9 +1337,9 @@
zend_hash_internal_pointer_reset_ex(src, &pos);
while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) ==
SUCCESS) {
key_type = zend_hash_get_current_key_ex(src, &string_key,
&string_key_len, &num_key, 0, &pos);
- if (Z_TYPE_PP(src_entry) != IS_ARRAY ||
- (string_key_len && zend_hash_find(dest, string_key,
string_key_len, (void **)&dest_entry) != SUCCESS) ||
- (!string_key_len && zend_hash_index_find(dest,
num_key, (void **)&dest_entry) != SUCCESS)
+ if (Z_TYPE_PP(src_entry) != IS_ARRAY
+ || (key_type==HASH_KEY_IS_STRING &&
zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) != SUCCESS)
+ || (key_type==HASH_KEY_IS_LONG &&
zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS)
|| Z_TYPE_PP(dest_entry) != IS_ARRAY) {
(*src_entry)->refcount++;
if (key_type == HASH_KEY_IS_STRING) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php