From: Antony Dovgal Date: Wed, 3 Dec 2008 10:11:04 +0000 (+0000) Subject: fix possible invalid read X-Git-Tag: BEFORE_HEAD_NS_CHANGES_MERGE~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1775daba17282eb96fb63afd393ca7ca3fa2a46;p=php fix possible invalid read --- 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",