[PATCH 2/2] advapi32: Fix the initialization of combined DACLs when the new DACL is empty.
Vijay Kiran Kamuju
infyquest at gmail.com
Thu Apr 25 04:36:15 CDT 2019
From: "Erich E. Hoover" <erich.e.hoover at wine-staging.com>
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38423
From: Erich E. Hoover <erich.e.hoover at wine-staging.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
dlls/advapi32/security.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index c2c45aca4ae..a2ff678aabd 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -5966,6 +5966,7 @@ BOOL WINAPI FileEncryptionStatusA(LPCSTR lpFileName, LPDWORD lpStatus)
static NTSTATUS combine_dacls(ACL *parent, ACL *child, ACL **result)
{
+ NTSTATUS status;
ACL *combined;
int i;
@@ -5974,8 +5975,26 @@ static NTSTATUS combine_dacls(ACL *parent, ACL *child, ACL **result)
if (!combined)
return STATUS_NO_MEMORY;
- memcpy(combined, child, child->AclSize);
- combined->AclSize = child->AclSize+parent->AclSize;
+ status = RtlCreateAcl(combined, parent->AclSize+child->AclSize, ACL_REVISION);
+ if (status != STATUS_SUCCESS)
+ {
+ heap_free(combined);
+ return status;
+ }
+
+ /* copy the new ACEs */
+ for (i=0; i<child->AceCount; i++)
+ {
+ ACE_HEADER *ace;
+
+ if (!GetAce(child, i, (void*)&ace))
+ {
+ WARN("error obtaining new ACE\n");
+ continue;
+ }
+ if (!AddAce(combined, ACL_REVISION, MAXDWORD, ace, ace->AceSize))
+ WARN("error adding new ACE\n");
+ }
/* copy the inherited ACEs */
for (i=0; i<parent->AceCount; i++)
--
2.17.0
More information about the wine-devel
mailing list