Skip to content

Commit 71e9013

Browse files
committed
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>
1 parent c79d5b8 commit 71e9013

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ext/odbc/php_odbc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ int odbc_bindcols(odbc_result *result)
956956

957957
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME,
958958
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
959+
result->values[i].coltype = 0;
959960
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
960961
NULL, 0, NULL, &result->values[i].coltype);
961962

0 commit comments

Comments
 (0)