Zebediah Figura : netapi32/tests: Fix the size passed to GetUserNameW() and GetComputerNameW() (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Jan 13 16:11:52 CST 2020


Module: wine
Branch: master
Commit: 8341b51bf66a38b5d830931995b839cc99c00b42
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8341b51bf66a38b5d830931995b839cc99c00b42

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Jan 12 14:27:06 2020 -0600

netapi32/tests: Fix the size passed to GetUserNameW() and GetComputerNameW() (Coverity).

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/netapi32/tests/access.c | 4 ++--
 dlls/netapi32/tests/wksta.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/netapi32/tests/access.c b/dlls/netapi32/tests/access.c
index 3cf6cb35dd..0f0ac5417f 100644
--- a/dlls/netapi32/tests/access.c
+++ b/dlls/netapi32/tests/access.c
@@ -494,10 +494,10 @@ START_TEST(access)
     pDavGetHTTPFromUNCPath = (void*)GetProcAddress(hnetapi32, "DavGetHTTPFromUNCPath");
     pDavGetUNCFromHTTPPath = (void*)GetProcAddress(hnetapi32, "DavGetUNCFromHTTPPath");
 
-    size = sizeof(user_name);
+    size = ARRAY_SIZE(user_name);
     ret = GetUserNameW(user_name, &size);
     ok(ret, "Failed to get user name, error %u.\n", GetLastError());
-    size = sizeof(computer_name);
+    size = ARRAY_SIZE(computer_name);
     ret = GetComputerNameW(computer_name, &size);
     ok(ret, "Failed to get computer name, error %u.\n", GetLastError());
 
diff --git a/dlls/netapi32/tests/wksta.c b/dlls/netapi32/tests/wksta.c
index 684905c4dc..f53fcbbcce 100644
--- a/dlls/netapi32/tests/wksta.c
+++ b/dlls/netapi32/tests/wksta.c
@@ -175,10 +175,10 @@ START_TEST(wksta)
 
     pNetpGetComputerName = (void *)GetProcAddress(GetModuleHandleA("netapi32.dll"), "NetpGetComputerName");
 
-    size = sizeof(user_name);
+    size = ARRAY_SIZE(user_name);
     ret = GetUserNameW(user_name, &size);
     ok(ret, "Failed to get user name, error %u.\n", GetLastError());
-    size = sizeof(computer_name);
+    size = ARRAY_SIZE(computer_name);
     ret = GetComputerNameW(computer_name, &size);
     ok(ret, "Failed to get computer name, error %u.\n", GetLastError());
 




More information about the wine-cvs mailing list