Fix S0C4 in process_dd for multi-digit SPACE values#22
Merged
mgrossmann merged 1 commit intomainfrom Mar 12, 2026
Merged
Conversation
The 0x83 sub-key handler used a hardcoded buf += 7, which only worked for single-digit SPACE values (e.g. 1,1,1). Multi-digit values like (600,100,200) use longer length-prefixed encodings, causing the parser to misalign and overflow stack buffers via DDK/DSNAMEK/SYSOUTK memcpy calls, corrupting R13 and triggering S0C4 on function return. Replace hardcoded advancement with a proper loop that follows length-prefixed values. Add bounds checking on memcpy lengths as defense in depth. Closes #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buf += 7in the0x83SPACE quantities handler to properly parse variable-length length-prefixed valuesRoot Cause
The
0x83sub-key encodes SPACE quantities as length-prefixed numeric strings. Single-digit values like(1,1,1)are 7 bytes total, but multi-digit values like(600,100,200)are 13 bytes. The hardcoded advancement misaligned the parser, causing stack buffer overflows and R13 corruption → S0C4.Test plan
mbtbulk build for a project with large SPACE values (e.g. FTPD withSPACE=(TRK,(600,100,200)))Closes #21