Properly handle sysconf(_SC_LOGIN_NAME_MAX) returning -1 on failure.
The cast to size_t needs to be outside the MAX() macro or the -1 will get cast to unsigned.
This commit is contained in:
@@ -421,7 +421,7 @@ cvtsudoers_make_grlist_item(const struct passwd *pw, char * const *unused1)
|
||||
}
|
||||
|
||||
#ifdef _SC_LOGIN_NAME_MAX
|
||||
groupname_len = MAX((size_t)sysconf(_SC_LOGIN_NAME_MAX), 32);
|
||||
groupname_len = (size_t)MAX(sysconf(_SC_LOGIN_NAME_MAX), 32);
|
||||
#else
|
||||
groupname_len = MAX(LOGIN_NAME_MAX, 32);
|
||||
#endif
|
||||
|
@@ -381,7 +381,7 @@ PREFIX(make_grlist_item)(const struct passwd *pw, char * const *unused1)
|
||||
}
|
||||
|
||||
#ifdef _SC_LOGIN_NAME_MAX
|
||||
groupname_len = MAX((size_t)sysconf(_SC_LOGIN_NAME_MAX), 32);
|
||||
groupname_len = (size_t)MAX(sysconf(_SC_LOGIN_NAME_MAX), 32);
|
||||
#else
|
||||
groupname_len = MAX(LOGIN_NAME_MAX, 32);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user