[PATCH v2 0/2] MR7013: odbc32: Add null pointer checks.
"erwin Data Modeler" crashes under Wine when making ODBC connections (to native ODBC drivers on macOS via iODBC) due to passing in `NULL` values in places. These checks allow execution to proceed successfully. -- v2: odbc32: Add null pointer checks to update_result_lengths helpers. odbc32: Avoid crashing if str is null in debugstr_sqlstr. https://gitlab.winehq.org/wine/wine/-/merge_requests/7013
From: Owen Rudge <orudge(a)codeweavers.com> --- 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 62c240b6e90..e19fd179bc4 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1068,7 +1068,7 @@ SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu static const char *debugstr_sqlstr( const SQLCHAR *str, SQLSMALLINT len ) { - if (len == SQL_NTS) len = strlen( (const char *)str ); + if (len == SQL_NTS) len = (str == NULL) ? 0 : strlen( (const char *)str ); return wine_dbgstr_an( (const char *)str, len ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7013
From: Owen Rudge <orudge(a)codeweavers.com> --- dlls/odbc32/proxyodbc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index e19fd179bc4..cee20b41f30 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1833,6 +1833,9 @@ SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, static void len_to_user( SQLLEN *ptr, UINT8 *len, UINT row_count, UINT width ) { UINT i; + + if (ptr == NULL) return; + for (i = 0; i < row_count; i++) { *ptr++ = *(SQLLEN *)(len + i * width); @@ -1842,6 +1845,9 @@ static void len_to_user( SQLLEN *ptr, UINT8 *len, UINT row_count, UINT width ) static void len_from_user( UINT8 *len, SQLLEN *ptr, UINT row_count, UINT width ) { UINT i; + + if (ptr == NULL) return; + for (i = 0; i < row_count; i++) { *(SQLLEN *)(len + i * width) = *ptr++; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7013
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7013
participants (3)
-
Hans Leidekker (@hans) -
Owen Rudge -
Owen Rudge (@orudge)