From: Todd C. Miller Date: Mon, 11 Jan 2016 23:52:52 +0000 (-0700) Subject: Fix free() of invalid pointer introduced in the commit that stripped X-Git-Tag: SUDO_1_8_16^2~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9308d05e7e73fa00daf2143fd899d618a7a89c30;p=sudo Fix free() of invalid pointer introduced in the commit that stripped whitespace between a '!' and the name in a sudoOption. --- 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;