Fix snprintf buffer size for ExpectedCombinedOptions in lxtfs (#40493)
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: benhillis <17727402+benhillis@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ben Hillis committed
May 11, 2026 at 13:32 UTC
2b3fc852dd6140c372de02541fc2b65f62218e87
1 file changed
+1
-1
test/linux/unit_tests/lxtfs.c
+1
-1
@@ -231,7 +231,7 @@ Return Value:
231
}
232
233
snprintf(ExpectedOptions, sizeof(ExpectedOptions), "rw,%s", Options);
234
- snprintf(ExpectedCombinedOptions, sizeof(ExpectedOptions), "rw,noatime,%s", Options);
234
+ snprintf(ExpectedCombinedOptions, sizeof(ExpectedCombinedOptions), "rw,noatime,%s", Options);
235
236
LxtCheckResult(MountCheckIsMount(Target, ParentId, Source, "drvfs", MountRoot, "rw,noatime", ExpectedOptions, ExpectedCombinedOptions, 0));
237
}