https://git.reactos.org/?p=reactos.git;a=commitdiff;h=95c3e17a80a6645c51d3316953e42b21e098c574

commit 95c3e17a80a6645c51d3316953e42b21e098c574
Author:     Thomas Faber <[email protected]>
AuthorDate: Sun Jun 10 15:45:57 2018 +0200
Commit:     Thomas Faber <[email protected]>
CommitDate: Sun Jun 10 19:05:26 2018 +0200

    [ADVAPI32] Fix crash when running advapi32:security with DPH.
    
    Import the following Wine commits:
    * 79636bebbfa Michael Müller: advapi32: Set last error to ERROR_SUCCESS in 
GetSidIdentifierAuthority.
    * 1d03ba76116 Hans Leidekker: advapi32: Fix parsing empty DACL/SACL 
security descriptor strings.
    * 5bc2e83c7ab Hans Leidekker: advapi32: Fix size returned from 
ConvertStringSecurityDescriptorToSecurityDescriptor on 64-bit.
---
 dll/win32/advapi32/wine/security.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dll/win32/advapi32/wine/security.c 
b/dll/win32/advapi32/wine/security.c
index 5885f5d738..54dd595d49 100644
--- a/dll/win32/advapi32/wine/security.c
+++ b/dll/win32/advapi32/wine/security.c
@@ -759,6 +759,7 @@ PSID_IDENTIFIER_AUTHORITY
 WINAPI
 GetSidIdentifierAuthority(PSID pSid)
 {
+    SetLastError(ERROR_SUCCESS);
     return RtlIdentifierAuthoritySid(pSid);
 }
 
@@ -2227,7 +2228,7 @@ static DWORD ParseAclStringFlags(LPCWSTR* StringAcl)
     DWORD flags = 0;
     LPCWSTR szAcl = *StringAcl;
 
-    while (*szAcl != '(')
+    while (*szAcl && *szAcl != '(')
     {
         if (*szAcl == 'P')
         {
@@ -2538,7 +2539,7 @@ static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, 
LPDWORD lpdwFlags,
         pAcl->AclRevision = ACL_REVISION;
         pAcl->Sbz1 = 0;
         pAcl->AclSize = length;
-        pAcl->AceCount = acecount++;
+        pAcl->AceCount = acecount;
         pAcl->Sbz2 = 0;
     }
     return TRUE;
@@ -2549,7 +2550,6 @@ lerr:
     return FALSE;
 }
 
-
 /******************************************************************************
  * ParseStringSecurityDescriptorToSecurityDescriptor
  */
@@ -2565,7 +2565,7 @@ static BOOL 
ParseStringSecurityDescriptorToSecurityDescriptor(
     LPBYTE lpNext = NULL;
     DWORD len;
 
-    *cBytes = sizeof(SECURITY_DESCRIPTOR);
+    *cBytes = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
 
     tok = heap_alloc( (lstrlenW(StringSecurityDescriptor) + 1) * 
sizeof(WCHAR));
 

Reply via email to