From 71e9013bab22585d47f1f8c02b4c7d93b43298f4 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 29 Apr 2019 12:17:38 +0200 Subject: [PATCH] Properly initialize out parameter The MS docs on `SQLColAttribute()`[1] state regarding the `NumericAttributePtr` parameter: | Please note that some drivers may only write the lower 32-bit or | 16-bit of a buffer and leave the higher-order bit unchanged. | Therefore, applications should initialize the value to 0 before | calling this function. [1] --- ext/odbc/php_odbc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 37a207e6247..35da5a48a2f 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -956,6 +956,7 @@ int odbc_bindcols(odbc_result *result) rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); + result->values[i].coltype = 0; rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype);