Zebediah Figura : kernelbase: Return E_INVALIDARG when requesting URL_PART_USERNAME and there is no username.
Alexandre Julliard
julliard at winehq.org
Wed Feb 16 15:30:22 CST 2022
Module: wine
Branch: master
Commit: 68323afa08056c61c5aa1731c0884c8119b04af5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=68323afa08056c61c5aa1731c0884c8119b04af5
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Tue Feb 15 21:52:12 2022 -0600
kernelbase: Return E_INVALIDARG when requesting URL_PART_USERNAME and there is no username.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/path.c | 2 ++
dlls/shlwapi/tests/url.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index be487e71a3a..ad823cae547 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4321,6 +4321,8 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
break;
case URL_PART_USERNAME:
+ if (!pl.username)
+ return E_INVALIDARG;
if (!pl.username_len)
{
*out = '\0';
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 3bfd8961c8f..5d982467cea 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -621,13 +621,13 @@ static void test_UrlGetPart(void)
{"http://foo:bar@localhost:21/internal.php?query=x&return=y", URL_PART_PORT, URL_PARTFLAG_KEEPSCHEME, S_OK, "http:21"},
{"http://foo:bar@localhost:21/internal.php?query=x&return=y", URL_PART_QUERY, URL_PARTFLAG_KEEPSCHEME, S_OK, "query=x&return=y"},
- {"http://localhost/", URL_PART_USERNAME, 0, E_INVALIDARG, .todo_hr = TRUE},
+ {"http://localhost/", URL_PART_USERNAME, 0, E_INVALIDARG},
{"http://localhost/", URL_PART_PASSWORD, 0, E_INVALIDARG, .todo_hr = TRUE},
{"http://localhost/", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"http://localhost/", URL_PART_PORT, 0, E_INVALIDARG, .todo_hr = TRUE},
{"http://localhost/", URL_PART_QUERY, 0, S_FALSE, ""},
- {"http://localhost:port/", URL_PART_USERNAME, 0, E_INVALIDARG, .todo_hr = TRUE},
+ {"http://localhost:port/", URL_PART_USERNAME, 0, E_INVALIDARG},
{"http://localhost:port/", URL_PART_PASSWORD, 0, E_INVALIDARG, .todo_hr = TRUE},
{"http://localhost:port/", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"http://localhost:port/", URL_PART_PORT, 0, S_OK, "port"},
More information about the wine-cvs
mailing list