lib/chkname.c: Take NUL byte into account
The _SC_LOGIN_NAME_MAX value includes space for the NUL byte. The length of name must smaller than this value to be valid. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
committed by
Serge Hallyn
parent
37b02a5f88
commit
403a2e3771
+1
-1
@@ -80,7 +80,7 @@ bool is_valid_user_name (const char *name)
|
||||
* User names length are limited by the kernel
|
||||
*/
|
||||
maxlen = sysconf(_SC_LOGIN_NAME_MAX);
|
||||
if (strlen(name) > maxlen)
|
||||
if (strlen(name) >= maxlen)
|
||||
return false;
|
||||
|
||||
return is_valid_name (name);
|
||||
|
||||
Reference in New Issue
Block a user