Zebediah Figura : kernelbase: Include the null terminator in the length passed to WideCharToMultiByte() in UrlGetPartA().
Alexandre Julliard
julliard at winehq.org
Mon Feb 14 15:41:29 CST 2022
Module: wine
Branch: master
Commit: 149b6869a26d0efd0c272566d050f392ebd3952c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=149b6869a26d0efd0c272566d050f392ebd3952c
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Sun Feb 13 12:43:59 2022 -0600
kernelbase: Include the null terminator in the length passed to WideCharToMultiByte() in UrlGetPartA().
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/path.c | 4 ++--
dlls/shlwapi/tests/url.c | 8 +++-----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 7cfff358fdb..15280a7ea4b 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4148,10 +4148,10 @@ HRESULT WINAPI UrlGetPartA(const char *url, char *out, DWORD *out_len, DWORD par
return hr;
}
- len2 = WideCharToMultiByte(CP_ACP, 0, outW, len, NULL, 0, NULL, NULL);
+ len2 = WideCharToMultiByte(CP_ACP, 0, outW, len + 1, NULL, 0, NULL, NULL);
if (len2 > *out_len)
{
- *out_len = len2 + 1;
+ *out_len = len2;
heap_free(inW);
return E_POINTER;
}
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 212ee039a0b..b4b66aec2f1 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -782,7 +782,7 @@ static void test_UrlGetPart(void)
size = 1;
strcpy(buffer, "x");
hr = UrlGetPartA(url, buffer, &size, part, flags);
- todo_wine_if (tests[i].todo_hr || !strcmp(url, "http://host?a:b@c:d"))
+ todo_wine_if (tests[i].todo_hr)
{
if (tests[i].hr == S_OK)
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
@@ -807,11 +807,9 @@ static void test_UrlGetPart(void)
}
else
{
- todo_wine_if (hr == S_OK)
- ok(size == 1, "Got size %u.\n", size);
+ ok(size == 1, "Got size %u.\n", size);
}
- todo_wine_if (hr == S_OK)
- ok(!strcmp(buffer, "x"), "Got result %s.\n", debugstr_a(buffer));
+ ok(!strcmp(buffer, "x"), "Got result %s.\n", debugstr_a(buffer));
}
size = sizeof(buffer);
More information about the wine-cvs
mailing list