]> granicus.if.org Git - php/commitdiff
Properly initialize displaysize
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 24 Jun 2020 10:03:13 +0000 (12:03 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 24 Jun 2020 10:07:58 +0000 (12:07 +0200)
From Microsoft's `SQLColAttribute()` documentation[1]:

| 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>

ext/pdo_odbc/odbc_stmt.c

index 610c6121c58c9773821b4498f9789be0d6ccf3d4..6fd14a6f689c49947de66c533ec0d92dc12d1f1e 100644 (file)
@@ -565,7 +565,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno)
        RETCODE rc;
        SWORD   colnamelen;
        SQLULEN colsize;
-       SQLLEN displaysize;
+       SQLLEN displaysize = 0;
 
        rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname,
                        sizeof(S->cols[colno].colname)-1, &colnamelen,