com php-src: Properly initialize out parameter: ext/odbc/php_ odbc.c
| From: | Christoph Michael Becker | Date: | Mon, 29 Apr 2019 10:17:38 +0000 |
| Subject: | com php-src: Properly initialize out parameter: ext/odbc/php_ odbc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105966@lists.php.net to get a copy of this message | ||
Commit: 71e9013bab22585d47f1f8c02b4c7d93b43298f4
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 29 Apr 2019 12:17:38 +0200
Parents: c79d5b86e005655d10a41d72ff61c33387e88e09
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=71e9013bab22585d47f1f8c02b4c7d93b43298f4
Log:
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>
Changed paths:
M ext/odbc/php_odbc.c
Diff:
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 37a207e..35da5a4 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);