command_matches_glob: fix comparison of canonicalized parent directories

Bug #1062
This commit is contained in:
Todd C. Miller
2023-12-04 09:08:52 -07:00
parent 9c3eb2feca
commit 8dd2967766

View File

@@ -575,7 +575,7 @@ command_matches_glob(struct sudoers_context *ctx, const char *sudoers_cmnd,
/* Compare the canonicalized parent directories, if possible. */
if (ctx->user.cmnd_dir != NULL) {
char *slash = strchr(cp, '/');
char *slash = strrchr(cp, '/');
if (slash != NULL) {
char *resolved;
*slash = '\0';