Skip to content

Fix panic in xattr size queries with MaybeUninit buffers - #1711

Open
SAY-5 wants to merge 1 commit into
bytecodealliance:mainfrom
SAY-5:xattr-uninit-size-query
Open

SAY-5 wants to merge 1 commit into
bytecodealliance:mainfrom
SAY-5:xattr-uninit-size-query

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 18, 2026

Copy link
Copy Markdown

getxattr and listxattr return the attribute size when the buffer is too small, so with an empty &mut [MaybeUninit<u8>] the length handed to assume_init exceeds the buffer and split_at_mut panics with mid > len. This clamps the initialized length to the buffer length in the MaybeUninit impls, the same way recv already handles MSG_TRUNC; &mut [u8] buffers still report the full size.

Fixes #1693

Signed-off-by: Sai Asish Y <say.apm35@gmail.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.

xattr size queries panic with &mut [MaybeUninit<u8>] buffers

1 participant