Brendan Shanks : wow64: Ensure SECURITY_DESCRIPTOR fields are always initialized.

Alexandre Julliard julliard at winehq.org
Thu May 26 15:46:27 CDT 2022


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

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Wed May 25 20:07:46 2022 -0700

wow64: Ensure SECURITY_DESCRIPTOR fields are always initialized.

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>

---

 dlls/wow64/wow64_private.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/wow64/wow64_private.h b/dlls/wow64/wow64_private.h
index 1a9d05eaf43..b26148023db 100644
--- a/dlls/wow64/wow64_private.h
+++ b/dlls/wow64/wow64_private.h
@@ -146,17 +146,17 @@ static inline SECURITY_DESCRIPTOR *secdesc_32to64( SECURITY_DESCRIPTOR *out, con
     out->Control  = sd->Control & ~SE_SELF_RELATIVE;
     if (sd->Control & SE_SELF_RELATIVE)
     {
-        if (sd->Owner) out->Owner = (PSID)((BYTE *)sd + sd->Owner);
-        if (sd->Group) out->Group = (PSID)((BYTE *)sd + sd->Group);
-        if ((sd->Control & SE_SACL_PRESENT) && sd->Sacl) out->Sacl = (PSID)((BYTE *)sd + sd->Sacl);
-        if ((sd->Control & SE_DACL_PRESENT) && sd->Dacl) out->Dacl = (PSID)((BYTE *)sd + sd->Dacl);
+        out->Owner = sd->Owner ? (PSID)((BYTE *)sd + sd->Owner) : NULL;
+        out->Group = sd->Group ? (PSID)((BYTE *)sd + sd->Group) : NULL;
+        out->Sacl = ((sd->Control & SE_SACL_PRESENT) && sd->Sacl) ? (PSID)((BYTE *)sd + sd->Sacl) : NULL;
+        out->Dacl = ((sd->Control & SE_DACL_PRESENT) && sd->Dacl) ? (PSID)((BYTE *)sd + sd->Dacl) : NULL;
     }
     else
     {
         out->Owner = ULongToPtr( sd->Owner );
         out->Group = ULongToPtr( sd->Group );
-        if (sd->Control & SE_SACL_PRESENT) out->Sacl = ULongToPtr( sd->Sacl );
-        if (sd->Control & SE_DACL_PRESENT) out->Dacl = ULongToPtr( sd->Dacl );
+        out->Sacl = (sd->Control & SE_SACL_PRESENT) ? ULongToPtr( sd->Sacl ) : NULL;
+        out->Dacl = (sd->Control & SE_DACL_PRESENT) ? ULongToPtr( sd->Dacl ) : NULL;
     }
     return out;
 }




More information about the wine-cvs mailing list