Module: wine Branch: master Commit: be87c0838159898e361fb77710a3c1bf4c7b7c84 URL: https://gitlab.winehq.org/wine/wine/-/commit/be87c0838159898e361fb77710a3c1b...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Fri Jun 7 21:13:39 2024 +1000
odbccp32: Check if a full path was supplied for Driver/Setup/Translator entries.
---
dlls/odbccp32/odbccp32.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c index 90875121438..62e35e85f75 100644 --- a/dlls/odbccp32/odbccp32.c +++ b/dlls/odbccp32/odbccp32.c @@ -997,16 +997,28 @@ static void write_registry_values(const WCHAR *regkey, const WCHAR *driver, cons if(lstrcmpiW(driverW, entry) == 0 || lstrcmpiW(setupW, entry) == 0 || lstrcmpiW(translator, entry) == 0) { - len = lstrlenW(path) + lstrlenW(slash) + lstrlenW(divider) + 1; - value = malloc(len * sizeof(WCHAR)); - if(!value) + if(GetFileAttributesW(divider) == INVALID_FILE_ATTRIBUTES) { - ERR("Out of memory\n"); - return; + len = lstrlenW(path) + lstrlenW(slash) + lstrlenW(divider) + 1; + value = malloc(len * sizeof(WCHAR)); + if(!value) + { + ERR("Out of memory\n"); + return; + } + + lstrcpyW(value, path); + lstrcatW(value, slash); + } + else + { + value = calloc(1, (lstrlenW(divider)+1) * sizeof(WCHAR)); + if(!value) + { + ERR("Out of memory\n"); + return; + } } - - lstrcpyW(value, path); - lstrcatW(value, slash); lstrcatW(value, divider); } else