libroot: getlogin_r(): 32 is a valid length.

* also use LOGIN_NAME_MAX for the max length.
This commit is contained in:
Jérôme Duval 2016-10-29 22:34:41 +02:00
parent afbfc7e505
commit 58fb6344ae

View File

@ -30,9 +30,9 @@ int getlogin_r(char *name, size_t nameSize)
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw && (nameSize > 32/*PW_MAX_NAME*/)) {
if (pw && (nameSize >= LOGIN_NAME_MAX)) {
memset(name, 0, nameSize);
strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/);
strlcpy(name, pw->pw_name, LOGIN_NAME_MAX);
return B_OK;
}
return ENOMEM;