kernelbase: Include the null terminator in the length passed to WideCharToMultiByte() in UrlGetPartA().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-02-13 12:43:59 -06:00 committed by Alexandre Julliard
parent c0a131f9d9
commit 149b6869a2
2 changed files with 5 additions and 7 deletions

View File

@ -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;
}

View File

@ -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,10 +807,8 @@ static void test_UrlGetPart(void)
}
else
{
todo_wine_if (hr == S_OK)
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));
}