wininet: Make heap_strndupAtoW stop at the first null.
The analogous heap_strndupW already does this. Fixes InternetCrackUrlA behavior when passed a dwUrlLength that's past the end of the string. Signed-off-by: Tim Clem <tclem@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d4a417f885
commit
681ce692a0
|
@ -152,7 +152,10 @@ static inline WCHAR *heap_strndupAtoW(const char *str, int len_a, DWORD *len_w)
|
|||
|
||||
if(str) {
|
||||
size_t len;
|
||||
if(len_a < 0) len_a = strlen(str);
|
||||
if(len_a < 0)
|
||||
len_a = strlen(str);
|
||||
else if(len_a > 0)
|
||||
len_a = strnlen(str, len_a);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, str, len_a, NULL, 0);
|
||||
ret = heap_alloc((len+1)*sizeof(WCHAR));
|
||||
if(ret) {
|
||||
|
|
|
@ -659,7 +659,6 @@ static void InternetCrackUrl_test(void)
|
|||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
|
||||
ret = InternetCrackUrlA("http://x.org", 13 /* includes the nul */, 0, &urlComponents);
|
||||
ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError());
|
||||
todo_wine
|
||||
ok(urlComponents.dwHostNameLength == 5,
|
||||
"Expected dwHostNameLength of 5, got %d\n", urlComponents.dwHostNameLength);
|
||||
|
||||
|
@ -670,7 +669,6 @@ static void InternetCrackUrl_test(void)
|
|||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
|
||||
ret = InternetCrackUrlA("http://x.org\0/x", 15, 0, &urlComponents);
|
||||
ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError());
|
||||
todo_wine
|
||||
ok(urlComponents.dwUrlPathLength == 0,
|
||||
"Expected dwUrlPathLength of 0, got %d\n", urlComponents.dwUrlPathLength);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue