From 3924c1eabfa18d7b22d5917c8d6c44c8116606ba Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 19 Jun 2003 16:10:37 +0000 Subject: [PATCH] Fixed a possible crash in parse_context_options() --- ext/standard/file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index 72f3dfd7a4..aaf2359f58 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -877,16 +877,17 @@ static int parse_context_options(php_stream_context *context, zval *options) char *wkey, *okey; int wkey_len, okey_len; int ret = SUCCESS; + ulong num_key; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(options), &pos); while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_P(options), (void**)&wval, &pos)) { - if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &wkey_len, NULL, 0, &pos) + if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &wkey_len, &num_key, 0, &pos) && Z_TYPE_PP(wval) == IS_ARRAY) { zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos); while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(wval), (void**)&oval, &opos)) { - if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_PP(wval), &okey, &okey_len, NULL, 0, &opos)) { + if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_PP(wval), &okey, &okey_len, &num_key, 0, &opos)) { ZVAL_ADDREF(*oval); php_stream_context_set_option(context, wkey, okey, *oval); } -- 2.50.1