fix(vfs): size pts-index digit buffer for the full u32 range#130
Merged
Conversation
devpts and pty rendered the pts index to decimal digits in a 5-byte
stack buffer via 'while n > 0 { digits[dcount] = ...; dcount += 1 }'. The
index is a u32 (max 10 digits) bounded only by a configurable max_ptys,
so an index >= 100000 makes dcount reach 5 and digits[5] panics with an
out-of-bounds slice write (ring-0 halt). Size the buffer to the u32 worst
case ([u8; 10]). devpts = real_triggerable; pty = latent twin.
d7be407 to
2af0289
Compare
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.
devpts/pty rendered a u32 pts index into a 5-byte
[u8; 5]digit buffer (digits[dcount]in awhile n>0loop). An index >= 100000 (u32 bounded only by configurable max_ptys) makesdigits[5]an OOB slice-write panic (ring-0 halt). Sized to[u8; 10](u32 worst case). devpts = real_triggerable, pty = latent twin. Sibling decimal-buffer sites (drm_kms u16->[5], ima u8->[3], fat ~N guarded, pty_master u16->[8], fat32_lfn bounded) all verified correctly-sized. Gate: clippy -p oncrix-vfs ✓ + build ✓ + fmt ✓.