From a49555a9e1547a513e2f22d0a2a3ef92cddbec3d Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 25 Sep 2020 11:25:02 +0200 Subject: Fix #80147: BINARY strings may not be properly zero-terminated We have to manually ensure that all strings fetched from a data source are zero-terminated. Closes GH-6213. --- ext/odbc/php_odbc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/odbc/php_odbc.c') diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index c2d1a8f846..a93252f7c4 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -2221,6 +2221,7 @@ PHP_FUNCTION(odbc_result) if (rc != SQL_SUCCESS_WITH_INFO) { field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0); } + ZSTR_VAL(field_str)[ZSTR_LEN(field_str)] = '\0'; RETURN_NEW_STR(field_str); break; -- cgit v1.2.1