I ran into this trying to use the Mac-Native MS SQL Server ODBC driver
From: Stefan Dösinger stefan@codeweavers.com
If str == NULL && len == SQL_NTS we get a crash. wine_dbgstr_w handles NULL pointers gracefully. --- dlls/odbc32/proxyodbc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 7025a141bb6..91ad31b98b1 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -5814,7 +5814,7 @@ SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT StatementHandle, SQLUSMALLINT Column
static const char *debugstr_sqlwstr( const SQLWCHAR *str, SQLSMALLINT len ) { - if (len == SQL_NTS) len = wcslen( str ); + if (len == SQL_NTS) return wine_dbgstr_w( str ); return wine_dbgstr_wn( str, len ); }
From: Stefan Dösinger stefan@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 91ad31b98b1..d11b4122776 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -2456,9 +2456,9 @@ static SQLRETURN get_data_unix( struct statement *stmt, SQLUSMALLINT column, SQL { INT64 len; SQLRETURN ret; - struct SQLGetData_params params = { stmt->hdr.unix_handle, column, type, value, buflen, &len }; + struct SQLGetData_params params = { stmt->hdr.unix_handle, column, type, value, buflen, retlen ? &len : NULL};
- if (SUCCESS((ret = ODBC_CALL( SQLGetData, ¶ms )))) *retlen = len; + if (SUCCESS((ret = ODBC_CALL( SQLGetData, ¶ms ))) && retlen) *retlen = len; return ret; }
This merge request was approved by Hans Leidekker.