]> granicus.if.org Git - php/commitdiff
Fixed a possible corruption inside PDOStatement::debugDumpParams()
authorIlia Alshanetsky <iliaa@php.net>
Thu, 11 Dec 2008 15:32:24 +0000 (15:32 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 11 Dec 2008 15:32:24 +0000 (15:32 +0000)
ext/pdo/pdo_stmt.c

index f82261f6a8c54db049c6a69ab9512c4cf4dd13c5..4566312d1489a5a165160e854537e400b7273772 100755 (executable)
@@ -2209,7 +2209,9 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
                        if (res == HASH_KEY_IS_LONG) {
                                php_stream_printf(out TSRMLS_CC, "Key: Position #%ld:\n", num);
                        } else if (res == HASH_KEY_IS_STRING) {
-                               php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", len, len, str);
+                               char *s = estrndup(str, len);
+                               php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", len, len, s);
+                               efree(s);
                        }
 
                        php_stream_printf(out TSRMLS_CC, "paramno=%d\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",