git: 905120141436 - stable/14 - fusefs tests: Use memcpy to work around a -Wstrlcpy-strlcast-size warning
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Nov 2026 22:07:24 UTC
The branch stable/14 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=9051201414360ecd0fafb1637a71b834c4151cdd
commit 9051201414360ecd0fafb1637a71b834c4151cdd
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-04-11 19:12:58 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-11-23 22:07:16 +0000
fusefs tests: Use memcpy to work around a -Wstrlcpy-strlcast-size warning
tests/sys/fs/fusefs/xattr.cc:572:50: error: size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination [-Werror,-Wstrlcpy-strlcat-size]
572 | strlcpy((char*)out.body.bytes, attrs1, sizeof(attrs1));
| ~~~~~~~^~~~~~~
The warning is correct in that the size is the size of the source, but
that is intended in this case. Use memcpy() instead of strlcpy() to
match the same code in the size_only_race_smaller test above.
Differential Revision: https://reviews.freebsd.org/D49786
(cherry picked from commit faae895fec6571242ae05b11bc7eba0dff83fa49)
---
tests/sys/fs/fusefs/xattr.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/sys/fs/fusefs/xattr.cc b/tests/sys/fs/fusefs/xattr.cc
index a348315265c2..b863bdbc06e6 100644
--- a/tests/sys/fs/fusefs/xattr.cc
+++ b/tests/sys/fs/fusefs/xattr.cc
@@ -642,7 +642,7 @@ TEST_F(Listxattr, size_only_race_smaller)
}));
expect_listxattr(ino, sizeof(attrs0),
ReturnImmediate([&](auto in __unused, auto& out) {
- strlcpy((char*)out.body.bytes, attrs1, sizeof(attrs1));
+ memcpy((char*)out.body.bytes, attrs1, sizeof(attrs1));
out.header.len = sizeof(fuse_out_header) +
sizeof(attrs1);
})