Skip to content

Commit 513ad97

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Improve fix for #80783
2 parents 7f4513f + f421ebc commit 513ad97

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/pdo_odbc/odbc_stmt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,13 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo
650650
256, &C->fetched_len);
651651
orig_fetched_len = C->fetched_len;
652652

653-
if (rc == SQL_SUCCESS) {
653+
if (rc == SQL_SUCCESS && C->fetched_len < 256) {
654654
/* all the data fit into our little buffer;
655655
* jump down to the generic bound data case */
656656
goto in_data;
657657
}
658658

659-
if (rc == SQL_SUCCESS_WITH_INFO) {
659+
if (rc == SQL_SUCCESS_WITH_INFO || rc == SQL_SUCCESS) {
660660
/* this is a 'long column'
661661
662662
read the column in 255 byte blocks until the end of the column is reached, reassembling those blocks
@@ -683,7 +683,7 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo
683683
}
684684

685685
/* resize output buffer and reassemble block */
686-
if (rc==SQL_SUCCESS_WITH_INFO) {
686+
if (rc==SQL_SUCCESS_WITH_INFO || (rc==SQL_SUCCESS && C->fetched_len > 255)) {
687687
/* point 5, in section "Retrieving Data with SQLGetData" in http://msdn.microsoft.com/en-us/library/windows/desktop/ms715441(v=vs.85).aspx
688688
states that if SQL_SUCCESS_WITH_INFO, fetched_len will be > 255 (greater than buf2's size)
689689
(if a driver fails to follow that and wrote less than 255 bytes to buf2, this will AV or read garbage into buf) */

0 commit comments

Comments
 (0)