Skip to content

Potential fix for code scanning alert no. 243: Setting a DACL to NULL in a SECURITY_DESCRIPTOR#6

Closed
JaviLendi wants to merge 1 commit into
masterfrom
Fixes
Closed

Potential fix for code scanning alert no. 243: Setting a DACL to NULL in a SECURITY_DESCRIPTOR#6
JaviLendi wants to merge 1 commit into
masterfrom
Fixes

Conversation

@JaviLendi
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/JaviLendi/PrettySumatraPDF/security/code-scanning/243

Use a non-NULL ACL instead of a NULL DACL. The safest minimal-change fix is to build an empty DACL (an allocated ACL with no ACEs) and set that on the security descriptor. This keeps the object protected (no one gets access by default) and removes the dangerous NULL DACL pattern flagged by CodeQL.

In src/utils/WinUtil.cpp, inside ResetRegKeyAcl (around lines 567–577), replace the SetSecurityDescriptorDacl(..., nullptr, ...) block with:

  1. Allocate/initialize a small ACL buffer (ACL dacl; InitializeAcl(...)).
  2. Call SetSecurityDescriptorDacl(&secdesc, TRUE, &dacl, FALSE).
  3. Check return values and early-return safely on failure.
  4. Keep RegSetKeySecurity call only after successful descriptor setup.

No new imports/dependencies are required; all used WinAPI symbols are already available from existing Windows headers in this file.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… in a SECURITY_DESCRIPTOR

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@JaviLendi JaviLendi closed this May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant