Fix snprintf buffer size for ExpectedCombinedOptions in lxtfs#40493
Merged
benhillis merged 1 commit intoMay 11, 2026
Merged
Conversation
The second snprintf used sizeof(ExpectedOptions) (the wrong buffer) instead of sizeof(ExpectedCombinedOptions). This could allow truncation or overflow if the two buffers had different sizes, and is incorrect even when they happen to match. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes an incorrect snprintf size argument in the lxtfs unit test helper to ensure the destination buffer size is used when formatting ExpectedCombinedOptions.
Changes:
- Correct
snprintfto usesizeof(ExpectedCombinedOptions)when writing intoExpectedCombinedOptions.
5 tasks
OneBlue
approved these changes
May 11, 2026
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.
Split out from #40489.
The second snprintf in
MountCheckIsMountWithOptionsusedsizeof(ExpectedOptions)(the wrong buffer) when writing intoExpectedCombinedOptions. This is a buffer-size bug regardless of whether the two arrays happen to be the same size today; it should reference its own destination buffer.Change
test/linux/unit_tests/lxtfs.c: passsizeof(ExpectedCombinedOptions)to the matchingsnprintf.Validation