Skip to content

Fix snprintf buffer size for ExpectedCombinedOptions in lxtfs#40493

Merged
benhillis merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-lxtfs-snprintf-buffer
May 11, 2026
Merged

Fix snprintf buffer size for ExpectedCombinedOptions in lxtfs#40493
benhillis merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-lxtfs-snprintf-buffer

Conversation

@benhillis
Copy link
Copy Markdown
Member

Split out from #40489.

The second snprintf in MountCheckIsMountWithOptions used sizeof(ExpectedOptions) (the wrong buffer) when writing into ExpectedCombinedOptions. 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: pass sizeof(ExpectedCombinedOptions) to the matching snprintf.

Validation

  • Mechanical, single-line fix; no behavior change when buffers happen to be the same size.

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>
Copilot AI review requested due to automatic review settings May 11, 2026 17:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 snprintf to use sizeof(ExpectedCombinedOptions) when writing into ExpectedCombinedOptions.

@benhillis benhillis enabled auto-merge (squash) May 11, 2026 19:46
@benhillis benhillis merged commit 2b3fc85 into microsoft:master May 11, 2026
13 checks passed
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.

3 participants