1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

wshom/network: Check pointer argument in get_UserName().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-03-14 13:12:01 +01:00 committed by Alexandre Julliard
parent 30e5111dd5
commit 866cb1ca63
2 changed files with 6 additions and 0 deletions

View file

@ -126,6 +126,9 @@ static HRESULT WINAPI WshNetwork2_get_UserName(IWshNetwork2 *iface, BSTR *user_n
TRACE("%p, %p.\n", iface, user_name);
if (!user_name)
return E_POINTER;
GetUserNameW(NULL, &len);
*user_name = SysAllocStringLen(NULL, len-1);
if (!*user_name)

View file

@ -710,6 +710,9 @@ static void test_wshnetwork(void)
hr = IDispatch_QueryInterface(disp, &IID_IWshNetwork2, (void**)&nw2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IWshNetwork2_get_UserName(nw2, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
str = NULL;
hr = IWshNetwork2_get_UserName(nw2, &str);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);