From: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> --- dlls/odbccp32/odbccp32.c | 6 ++++++ dlls/odbccp32/tests/misc.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c index ab745ef1bb7..b77c5698c07 100644 --- a/dlls/odbccp32/odbccp32.c +++ b/dlls/odbccp32/odbccp32.c @@ -1586,6 +1586,12 @@ BOOL WINAPI SQLRemoveDSNFromIniW(LPCWSTR lpszDSN) TRACE("%s\n", debugstr_w(lpszDSN)); + if (!SQLValidDSNW(lpszDSN)) + { + push_error(ODBC_ERROR_INVALID_DSN, L"Invalid DSN"); + return FALSE; + } + clear_errors(); if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\ODBC\\ODBC.INI\\ODBC Data Sources", &hkey) == ERROR_SUCCESS) diff --git a/dlls/odbccp32/tests/misc.c b/dlls/odbccp32/tests/misc.c index b94ed811337..af149e6c973 100644 --- a/dlls/odbccp32/tests/misc.c +++ b/dlls/odbccp32/tests/misc.c @@ -885,6 +885,12 @@ static void test_SQLWriteDSNToIni(void) SQLSetConfigMode(ODBC_SYSTEM_DSN); + ret = SQLRemoveDSNFromIni(""); + ok(!ret, "got %d\n", ret); + + ret = SQLRemoveDSNFromIniW(L""); + ok(!ret, "got %d\n", ret); + ret = SQLWriteDSNToIni("wine_dbs", "SQL Server"); if (!ret) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6333