Avoid possible malloc(0) if plugin returns an empty groups list.
This commit is contained in:
@@ -494,7 +494,9 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
break;
|
||||
cp++;
|
||||
}
|
||||
details->groups = emalloc2(details->ngroups, sizeof(GETGROUPS_T));
|
||||
if (details->ngroups != 0) {
|
||||
details->groups =
|
||||
emalloc2(details->ngroups, sizeof(GETGROUPS_T));
|
||||
cp = info[i] + sizeof("runas_groups=") - 1;
|
||||
for (j = 0; j < details->ngroups;) {
|
||||
errno = 0;
|
||||
@@ -507,6 +509,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = ep + 1;
|
||||
}
|
||||
details->ngroups = j;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (strncmp("runas_uid=", info[i], sizeof("runas_uid=") - 1) == 0) {
|
||||
|
Reference in New Issue
Block a user