summaryrefslogtreecommitdiff
path: root/ext/odbc/php_odbc.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-04-29 12:17:38 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-04-29 12:17:38 +0200
commit71e9013bab22585d47f1f8c02b4c7d93b43298f4 (patch)
treedaf168eef78c2d49987e543f6e5d09bff7152d11 /ext/odbc/php_odbc.c
parentc79d5b86e005655d10a41d72ff61c33387e88e09 (diff)
downloadphp-git-71e9013bab22585d47f1f8c02b4c7d93b43298f4.tar.gz
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] <https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolattribute-function?view=sql-server-2017>
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r--ext/odbc/php_odbc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 37a207e624..35da5a48a2 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);