mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Fix off by one error when allocating user_groups.
This commit is contained in:
@@ -1237,12 +1237,14 @@ deserialize_info(char * const settings[], char * const user_info[])
|
||||
/* Count number of groups */
|
||||
const char *val = *cur + sizeof("groups=") - 1;
|
||||
const char *cp;
|
||||
for (cp = val; *cp != '\0'; cp++) {
|
||||
if (*cp == ',')
|
||||
user_ngroups++;
|
||||
}
|
||||
if (user_ngroups) {
|
||||
user_groups = emalloc2(user_ngroups, sizeof(gid_t));
|
||||
if (val[0] != '\0') {
|
||||
user_ngroups = 1;
|
||||
for (cp = val; *cp != '\0'; cp++) {
|
||||
if (*cp == ',')
|
||||
user_ngroups++;
|
||||
}
|
||||
|
||||
user_groups = emalloc2(user_ngroups, sizeof(GETGROUPS_T));
|
||||
user_ngroups = 0;
|
||||
cp = val;
|
||||
for (;;) {
|
||||
|
Reference in New Issue
Block a user