From 9308d05e7e73fa00daf2143fd899d618a7a89c30 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 11 Jan 2016 16:52:52 -0700 Subject: [PATCH] Fix free() of invalid pointer introduced in the commit that stripped whitespace between a '!' and the name in a sudoOption. --- plugins/sudoers/sssd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/sudoers/sssd.c b/plugins/sudoers/sssd.c index 0fb19f970..ade6a5a6b 100644 --- a/plugins/sudoers/sssd.c +++ b/plugins/sudoers/sssd.c @@ -1024,7 +1024,7 @@ sudo_sss_parse_options(struct sudo_sss_handle *handle, struct sss_sudo_rule *rul { int i, op; bool ret = false; - char *cp, *v; + char *copy, *cp, *v; char **val_array = NULL; debug_decl(sudo_sss_parse_options, SUDOERS_DEBUG_SSSD); @@ -1046,7 +1046,7 @@ sudo_sss_parse_options(struct sudo_sss_handle *handle, struct sss_sudo_rule *rul for (i = 0; val_array[i] != NULL; i++) { sudo_debug_printf(SUDO_DEBUG_INFO, "sssd/ldap sudoOption: '%s'", val_array[i]); - if ((v = strdup(val_array[i])) == NULL) { + if ((v = copy = strdup(val_array[i])) == NULL) { sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); goto done; } @@ -1090,7 +1090,7 @@ sudo_sss_parse_options(struct sudo_sss_handle *handle, struct sss_sudo_rule *rul /* case var Boolean True */ set_default(v, NULL, true); } - free(v); + free(copy); } ret = true; -- 2.50.1