Skip to content

Commit f421ebc

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Improve fix for #80783
2 parents 032905b + 25f5a1b commit f421ebc

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
@@ -663,13 +663,13 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong
663663
256, &C->fetched_len);
664664
orig_fetched_len = C->fetched_len;
665665

666-
if (rc == SQL_SUCCESS) {
666+
if (rc == SQL_SUCCESS && C->fetched_len < 256) {
667667
/* all the data fit into our little buffer;
668668
* jump down to the generic bound data case */
669669
goto in_data;
670670
}
671671

672-
if (rc == SQL_SUCCESS_WITH_INFO) {
672+
if (rc == SQL_SUCCESS_WITH_INFO || rc == SQL_SUCCESS) {
673673
/* this is a 'long column'
674674
675675
read the column in 255 byte blocks until the end of the column is reached, reassembling those blocks
@@ -698,7 +698,7 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong
698698
}
699699

700700
/* resize output buffer and reassemble block */
701-
if (rc==SQL_SUCCESS_WITH_INFO) {
701+
if (rc==SQL_SUCCESS_WITH_INFO || (rc==SQL_SUCCESS && C->fetched_len > 255)) {
702702
/* point 5, in section "Retrieving Data with SQLGetData" in http://msdn.microsoft.com/en-us/library/windows/desktop/ms715441(v=vs.85).aspx
703703
states that if SQL_SUCCESS_WITH_INFO, fetched_len will be > 255 (greater than buf2's size)
704704
(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)