]> granicus.if.org Git - php/commitdiff
Initalize return_value before use
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 17 Mar 2021 14:09:18 +0000 (15:09 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 17 Mar 2021 14:39:50 +0000 (15:39 +0100)
Otherwise we likely segfault[1].  We fix the same issue for
PDO_Firebird as well.

[1] <https://ci.appveyor.com/project/php/php-src/builds/38267250/job/6y3ngn1k6ryxx6j3?fullLog=true#L9783>

Closes GH-6785.

ext/pdo_firebird/firebird_statement.c
ext/pdo_odbc/odbc_stmt.c

index c0ce2618acdc70b745ede9f7b83933a188795aed..7fad08e2ad17053c3b1ed22551c4d0b5876376dc 100644 (file)
@@ -243,6 +243,7 @@ static int firebird_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval
                }
        }
 
+       array_init(return_value);
        add_assoc_long(return_value, "pdo_type", param_type);
        return 1;
 }
index f71d53927122adf29a34af414ea8a87e8384fad4..a80aab9a8873a471f771a0a5bb76c57c9b84a940 100644 (file)
@@ -627,6 +627,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno)
 
 static int odbc_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value)
 {
+       array_init(return_value);
        add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR);
        return 1;
 }