From b009782b5d926dfc00cab5375a8b284123fb3158 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 24 Jan 2024 22:39:33 +0100 Subject: [PATCH] user-util: add comments explaining what the user name size limits effectively mean --- src/basic/user-util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/basic/user-util.c b/src/basic/user-util.c index cee91541410..fa5dccfd169 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -797,11 +797,11 @@ bool valid_user_group_name(const char *u, ValidUserFlags flags) { sz = sysconf(_SC_LOGIN_NAME_MAX); assert_se(sz > 0); - if (l > (size_t) sz) + if (l > (size_t) sz) /* glibc: 256 */ return false; - if (l > NAME_MAX) /* must fit in a filename */ + if (l > NAME_MAX) /* must fit in a filename: 255 */ return false; - if (l > UT_NAMESIZE - 1) + if (l > UT_NAMESIZE - 1) /* must fit in utmp: 31 */ return false; }