From ecbe95589a2da44d20bb99730dc404bc161fdfc2 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 21 Feb 2021 13:35:00 -0700 Subject: [PATCH] Add missing globfree(3) in command_matches_glob() when matching a directory. --- plugins/sudoers/match_command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/sudoers/match_command.c b/plugins/sudoers/match_command.c index 91193bc53..997f8ce0f 100644 --- a/plugins/sudoers/match_command.c +++ b/plugins/sudoers/match_command.c @@ -464,8 +464,10 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args, /* If it ends in '/' it is a directory spec. */ dlen = strlen(cp); if (cp[dlen - 1] == '/') { - if (command_matches_dir(cp, dlen, runchroot, digests)) + if (command_matches_dir(cp, dlen, runchroot, digests)) { + globfree(&gl); debug_return_bool(true); + } continue; }