Fix potential double free for rules that include a CHROOT= option.
If a rule with a CHROOT= option matches the user, host and runas, the user_cmnd variable could be freed twice.
This commit is contained in:
@@ -825,12 +825,16 @@ command_matches(const char *sudoers_cmnd, const char *sudoers_args,
|
||||
/* Rule-specific runchroot, set user_cmnd and user_stat after pivot. */
|
||||
int status;
|
||||
|
||||
/* Save old user_cmnd first, set_cmnd_path() will free it. */
|
||||
saved_user_cmnd = user_cmnd;
|
||||
user_cmnd = NULL;
|
||||
if (user_stat != NULL)
|
||||
saved_user_stat = *user_stat;
|
||||
status = set_cmnd_path(NULL);
|
||||
if (status != FOUND)
|
||||
if (status != FOUND) {
|
||||
user_cmnd = saved_user_cmnd;
|
||||
saved_user_cmnd = NULL;
|
||||
}
|
||||
if (info != NULL)
|
||||
info->status = status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user