Skip to content

WinReg: fix memory over-read in GetHKeyName - #4

Merged
mgth merged 1 commit into
masterfrom
winreg-overread-fix
Jul 25, 2026
Merged

WinReg: fix memory over-read in GetHKeyName#4
mgth merged 1 commit into
masterfrom
winreg-overread-fix

Conversation

@mgth

@mgth mgth commented Jul 25, 2026

Copy link
Copy Markdown
Owner

`Marshal.Copy(pKni, bytes, 0, needed)` copied `needed` chars (2×`needed` bytes) from a buffer allocated for `needed` bytes, reading twice past the allocation.

Companion PR to mgth/LittleBigMouse#519, whose submodule pointer references this exact commit (3c825b0) — merge together, as was done for mgth/LittleBigMouse#476 + #2.

🤖 Generated with Claude Code

Marshal.Copy(pKni, chars, 0, needed) copied `needed` chars (2x needed
bytes) out of a buffer of needed+8 bytes. Replace with a byte-accurate
copy bounded by ZwQueryKey's returned length, and decode the
KEY_NAME_INFORMATION structure via its own NameLength field
(DecodeKeyNameInformation, exposed for reuse and tests).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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