Init cmnds to NULL in rule_to_priv() so we don't free a bogus pointer.

In the sssd backend, the rule_to_priv() cleanup code assumes cmnds
can be passed to fn_free_values(), which was not the case if we
receive an error getting values for "sudoCommand".  This is a
regression introduced in sudo 1.9.1.  Fix from Ron Bowes.
GitHub issue #67.
This commit is contained in:
Todd C. Miller
2020-10-09 14:16:06 -06:00
parent 607076d8a0
commit 807857a2ca

View File

@@ -240,7 +240,7 @@ static struct privilege *
sss_rule_to_priv(struct sudo_sss_handle *handle, struct sss_sudo_rule *rule,
int *rc_out)
{
char **cmnds, **runasusers = NULL, **runasgroups = NULL;
char **cmnds = NULL, **runasusers = NULL, **runasgroups = NULL;
char **opts = NULL, **notbefore = NULL, **notafter = NULL;
char **hosts = NULL, **cn_array = NULL, *cn = NULL;
struct privilege *priv = NULL;