Page MenuHomeFreeBSD

fusefs tests: Use memcpy to work around a -Wstrlcpy-strlcast-size warning
ClosedPublic

Authored by jhb on Apr 11 2025, 5:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 4, 2:40 AM
Unknown Object (File)
Fri, Sep 26, 4:13 PM
Unknown Object (File)
Tue, Sep 23, 3:03 AM
Unknown Object (File)
Sat, Sep 20, 10:38 PM
Unknown Object (File)
Sat, Sep 20, 2:30 PM
Unknown Object (File)
Wed, Sep 17, 9:54 PM
Unknown Object (File)
Sep 15 2025, 8:19 AM
Unknown Object (File)
Sep 12 2025, 1:35 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Apr 11 2025, 5:57 PM

I don't know why, but I got the new error after applying the change in D49787 (which makes no sense to me, I would have expected to have seen this error before regardless).

Hmm, I'm getting this on stock main it seems so will push it to fix the build.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 11 2025, 7:17 PM
This revision was automatically updated to reflect the committed changes.