[PATCH v5 4/9] landlock/selftests: Test LANDLOCK_ACCESS_FS_RESOLVE_UNIX
Günther Noack
gnoack3000 at gmail.com
Fri Feb 20 16:27:52 UTC 2026
On Wed, Feb 18, 2026 at 08:11:26PM +0100, Mickaël Salaün wrote:
> On Sun, Feb 15, 2026 at 11:51:52AM +0100, Günther Noack wrote:
> > --- a/tools/testing/selftests/landlock/fs_test.c
> > +++ b/tools/testing/selftests/landlock/fs_test.c
> > + strncpy(addr.sun_path, path, sizeof(addr.sun_path));
>
> fs_test.c: In function ‘set_up_named_unix_server’:
> fs_test.c:4125:9: error: ‘strncpy’ specified bound 108 equals destination size [-Werror=stringop-truncation]
> 4125 | strncpy(addr.sun_path, path, sizeof(addr.sun_path));
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> We should also ASSERT the result to make sure path's length is not too big.
Fair enough, will do, because it's less confusing.
(FWIW though, I think Linux can technically deal with a sun_path that
does not end in a NUL byte. See the long comment in unix_mkname_bsd().
But that's a Linux peculiarity.)
–Günther
More information about the Linux-security-module-archive
mailing list