Commit 149b6869 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

kernelbase: Include the null terminator in the length passed to…

kernelbase: Include the null terminator in the length passed to WideCharToMultiByte() in UrlGetPartA(). Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent c0a131f9
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment