]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/landlock: NULL-terminate unix pathname addresses
authorMatthieu Buffet <matthieu@buffet.re>
Tue, 2 Dec 2025 21:51:41 +0000 (22:51 +0100)
committerMickaël Salaün <mic@digikod.net>
Fri, 26 Dec 2025 19:38:58 +0000 (20:38 +0100)
commite4aa4461d4acb922ef45785581232f0588a6eea8
tree0053c5e67501bf1bbb8d596cb562403fdb5abadf
parente1a57c33590a50a6639798e60a597af4a23b0340
selftests/landlock: NULL-terminate unix pathname addresses

The size of Unix pathname addresses is computed in selftests using
offsetof(struct sockaddr_un, sun_path) + strlen(xxx). It should have
been that +1, which makes addresses passed to the libc and kernel
non-NULL-terminated. unix_mkname_bsd() fixes that in Linux so there is
no harm, but just using sizeof(the address struct) should improve
readability.

Signed-off-by: Matthieu Buffet <matthieu@buffet.re>
Reviewed-by: Günther Noack <gnoack@google.com>
Link: https://lore.kernel.org/r/20251202215141.689986-1-matthieu@buffet.re
Signed-off-by: Mickaël Salaün <mic@digikod.net>
tools/testing/selftests/landlock/fs_test.c
tools/testing/selftests/landlock/scoped_abstract_unix_test.c