2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Fix "sudo -l command args", broken in sudo 1.9.13.

The value of user_args should not contain the command to be run in
"sudo -l command args", only the arguments of the command being checked.
This restores the pre-1.9.13 behavior.  GitHub issue #249
This commit is contained in:
Todd C. Miller
2023-03-03 11:12:18 -07:00
parent b013711e48
commit d9e9307d98
3 changed files with 13 additions and 6 deletions

View File

@@ -1104,7 +1104,14 @@ set_cmnd(void)
/* set user_args */
free(user_args);
user_args = NULL;
if (NewArgc > 1) {
if (ISSET(sudo_mode, MODE_CHECK)) {
if (NewArgc > 2) {
/* Skip the command being listed in NewArgv[1]. */
user_args = strvec_join(NewArgv + 2, ' ', NULL);
if (user_args == NULL)
debug_return_int(NOT_FOUND_ERROR);
}
} else if (NewArgc > 1) {
if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL) &&
ISSET(sudo_mode, MODE_RUN)) {
/*