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

Zebediah Figura z.figura12 at gmail.com
Sun Jan 12 14:27:06 CST 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 0b6a5747312..f54b37b42ef 100644
--- a/dlls/netapi32/tests/access.c
+++ b/dlls/netapi32/tests/access.c
@@ -482,10 +482,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 684905c4dcb..f53fcbbcce1 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());
 
-- 
2.24.1




More information about the wine-devel mailing list