2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-03 07:45:47 +00:00

Use sudo_basename() instead of doing the equivalent manually.

This commit is contained in:
Todd C. Miller
2021-02-10 15:14:08 -07:00
parent 41fa461fe1
commit 0663ffbc3f
15 changed files with 38 additions and 101 deletions

View File

@@ -928,7 +928,7 @@ set_cmnd(void)
debug_return_int(NOT_FOUND_ERROR);
}
/* Default value for cmnd, overridden below. */
/* Default value for cmnd, overridden by set_cmnd_path() below. */
if (user_cmnd == NULL)
user_cmnd = NewArgv[0];
@@ -966,11 +966,7 @@ set_cmnd(void)
debug_return_int(NOT_FOUND_ERROR);
}
}
if ((user_base = strrchr(user_cmnd, '/')) != NULL)
user_base++;
else
user_base = user_cmnd;
user_base = sudo_basename(user_cmnd);
/* Convert "sudo sudoedit" -> "sudoedit" */
if (ISSET(sudo_mode, MODE_RUN) && strcmp(user_base, "sudoedit") == 0) {