[PATCH v5 0/3] MR10743: small odbc fixes
1)odbc32: compare strings case-insensitively in get_driver_filename() Driver names should be compared without case-sensetivity. unixODBC has no problems when testDSN got "Driver = SQLite3" instead of "Driver = SQLITE3" https://learn.microsoft.com/en-us/openspecs/sql_server_protocols/ms-odbcstr/... 2)odbc32: skip set_value for NULL filename in replicate_odbc_to_registry() get_driver_filename can return NULL, for example when \~/.odbc.ini contains driver that has been deleted. We want to prevent SIGSEGV because of wcslen(filename) when filename is NULL. 3)odbc32: check if row_number is NULL in param_options_unix() According to documentation, SQLParamOptions can accept NULL row_number. Now when NULL row_nuber is passed, crash happens 4)odbc32: make sure ODBC_CALL returns SQLRETURN Not sure about this one, need opinion. The targeted problem: now ODBC_CALL return SQLRETURN which is truncated from NTSTATUS. If WINE_UNIX_CALL fails at some point, ODBC_CALL returns truncated NTSTATUS error code, STATUS_ACCESS_VIOLATION (0xC0000005) truncated to 5, then function gets invalid SQLRETURN. The following solution checks of NTSTATUS is actually short SQLRETURN casted to NTSTATUS. -- v5: odbc32: Check if row_number is NULL in param_options_unix(). odbc32: Skip operations for NULL filename in replicate_odbc_to_registry(). https://gitlab.winehq.org/wine/wine/-/merge_requests/10743
From: Ivan Ivlev <iviv@etersoft.ru> Signed-off-by: Ivan Ivlev <iviv@etersoft.ru> --- dlls/odbc32/unixlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/odbc32/unixlib.c b/dlls/odbc32/unixlib.c index 94965951794..b0e28b9f42f 100644 --- a/dlls/odbc32/unixlib.c +++ b/dlls/odbc32/unixlib.c @@ -568,7 +568,7 @@ static WCHAR *get_driver_filename( const WCHAR *name ) WCHAR buffer[1024]; KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; - if (wcscmp( name, drivers.names[i] )) continue; + if (wcsicmp( name, drivers.names[i] )) continue; if ((key_driver = open_key( key_odbcinst, drivers.names[i], wcslen(drivers.names[i]) * sizeof(WCHAR) ))) { if (query_value( key_driver, driverW, sizeof(driverW), info, sizeof(buffer) ) && info->Type == REG_SZ && -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10743
From: Ivan Ivlev <iviv@etersoft.ru> Signed-off-by: Ivan Ivlev <iviv@etersoft.ru> --- dlls/odbc32/unixlib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/odbc32/unixlib.c b/dlls/odbc32/unixlib.c index b0e28b9f42f..cf20bf37cce 100644 --- a/dlls/odbc32/unixlib.c +++ b/dlls/odbc32/unixlib.c @@ -636,6 +636,7 @@ static void replicate_odbc_to_registry( BOOL is_user, SQLHENV env ) KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; dir = SQL_FETCH_NEXT; + if (!filename) continue; if (!query_value( key_sources, dsn, len_dsn * sizeof(WCHAR), info, sizeof(buffer) ) && desc[0]) { set_value( key_sources, dsn, len_dsn * sizeof(WCHAR), REG_SZ, (const BYTE *)desc, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10743
From: Ivan Ivlev <iviv@etersoft.ru> Signed-off-by: Ivan Ivlev <iviv@etersoft.ru> --- 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 9f1d3f1377f..2ced00dc3fd 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -5524,7 +5524,7 @@ static SQLRETURN param_options_unix( struct statement *stmt, SQLULEN row_count, struct SQLParamOptions_params params = { stmt->hdr.unix_handle, row_count, &row }; SQLRETURN ret; - if (SUCCESS((ret = ODBC_CALL( SQLParamOptions, ¶ms )))) *row_number = row; + if (SUCCESS((ret = ODBC_CALL( SQLParamOptions, ¶ms ))) && row_number) *row_number = row; return ret; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10743
odbc32: Skip operations for NULL filename in replicate_odbc_to_registry(). Continue right away if filename is NULL, no warning message. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10743#note_137772
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10743
This merge request was approved by Ivan Ivlev. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10743
participants (3)
-
Hans Leidekker (@hans) -
Ivan Ivlev -
Ivan Ivlev (@iviv)