From a1775daba17282eb96fb63afd393ca7ca3fa2a46 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 3 Dec 2008 10:11:04 +0000 Subject: [PATCH] fix possible invalid read --- ext/pdo/pdo_stmt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 79ef39828e..2dc02d2233 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2202,11 +2202,15 @@ static PHP_METHOD(PDOStatement, debugDumpParams) zstr str; uint len; ulong num; + int res; - if (zend_hash_get_current_key_ex(stmt->bound_params, &str, &len, &num, 0, &pos) == HASH_KEY_IS_LONG) { + res = zend_hash_get_current_key_ex(stmt->bound_params, &str, &len, &num, 0, &pos); + if (res == HASH_KEY_IS_LONG) { php_stream_printf(out TSRMLS_CC, "Key: Position #%ld:\n", num); - } else { - php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", len, len, str); + } else if (res == HASH_KEY_IS_STRING) { + php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", len, len, str.s); + } else if (res == HASH_KEY_IS_UNICODE) { + php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*r\n", len, len, str.u); } php_stream_printf(out TSRMLS_CC, "paramno=%d\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n", -- 2.50.1