Skip to content

Commit

Permalink
Fix wrong DACL memory size on Windows (createWindowsDACL) (#10712)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
idrassi authored May 21, 2024
1 parent da90319 commit e7aa092
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/Bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit e7aa092

Please sign in to comment.