Fix wrong DACL memory size on Windows (createWindowsDACL) (#10712)

Each AddAccessAllowedAce invocation should be matched with a corresponding sizeof(ACCESS_ALLOWED_ACE) and the respective GetLengthSid of the SID being used. This ensures that there is enough space in the ACL for each entry.

The issue manifest itself only when WITH_XC_SSHAGENT is defined.
This commit is contained in:
Mounir IDRASSI 2024-05-21 11:17:43 +02:00 committed by Jonathan White
parent 388b4a736a
commit 6e362ee637
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -180,7 +180,8 @@ namespace Bootstrap
// Calculate the amount of memory that must be allocated for the DACL
cbACL = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pTokenUser->User.Sid)
+ sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pLocalSystemSid) + GetLengthSid(pOwnerRightsSid);
+ sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pLocalSystemSid) + sizeof(ACCESS_ALLOWED_ACE)
+ GetLengthSid(pOwnerRightsSid);
// Create and initialize an ACL
pACL = static_cast<PACL>(HeapAlloc(GetProcessHeap(), 0, cbACL));