Make sure groupname_len is at least 32 just to be on the safe side.
It is better to allocate a little extra and not need it than to have to reallocate and start over.
This commit is contained in:
@@ -271,10 +271,10 @@ sudo_make_grlist_item(struct passwd *pw)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_SYSCONF) && defined(_SC_LOGIN_NAME_MAX)
|
#if defined(HAVE_SYSCONF) && defined(_SC_LOGIN_NAME_MAX)
|
||||||
groupname_len = (int)sysconf(_SC_LOGIN_NAME_MAX);
|
groupname_len = MAX((int)sysconf(_SC_LOGIN_NAME_MAX), 32);
|
||||||
if (groupname_len < 0)
|
#else
|
||||||
|
groupname_len = MAX(LOGIN_NAME_MAX, 32);
|
||||||
#endif
|
#endif
|
||||||
groupname_len = LOGIN_NAME_MAX;
|
|
||||||
|
|
||||||
/* Allocate in one big chunk for easy freeing. */
|
/* Allocate in one big chunk for easy freeing. */
|
||||||
nsize = strlen(pw->pw_name) + 1;
|
nsize = strlen(pw->pw_name) + 1;
|
||||||
|
Reference in New Issue
Block a user