[PATCH] advapi32: Initialize luid in test_CreateRestrictedToken

Gerald Pfeifer gerald at pfeifer.com
Tue Nov 24 16:38:49 CST 2020


We have the following loop in test_CreateRestrictedToken which
can leave luid uninitialized:

    for (i = 0; i < privs->PrivilegeCount; i++)
    {
        if (privs->Privileges[i].Attributes & SE_PRIVILEGE_ENABLED)
        {
            luid = privs->Privileges[i].Luid;
            break;
        }
    }

So let's play it safely and initialize this upon declaration.

This is being diagnosed by clang 10.0.1, which is not the compiler
I ever use for production code, but that occasionally "sneaks" in.

Gerald


Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
 dlls/advapi32/tests/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index eaaa29866bb..020e69277e0 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -5195,7 +5195,7 @@ static void test_CreateRestrictedToken(void)
     TOKEN_TYPE type;
     BOOL is_member;
     DWORD size;
-    LUID luid;
+    LUID luid = { 0, 0 };
     BOOL ret;
     DWORD i;
 
-- 
2.28.0



More information about the wine-devel mailing list