Fix free() of invalid pointer introduced in the commit that stripped
whitespace between a '!' and the name in a sudoOption.
This commit is contained in:
@@ -1046,7 +1046,7 @@ static bool
|
|||||||
sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
||||||
{
|
{
|
||||||
struct berval **bv, **p;
|
struct berval **bv, **p;
|
||||||
char *cp, *var;
|
char *copy, *cp, *var;
|
||||||
int op;
|
int op;
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
debug_decl(sudo_ldap_parse_options, SUDOERS_DEBUG_LDAP)
|
debug_decl(sudo_ldap_parse_options, SUDOERS_DEBUG_LDAP)
|
||||||
@@ -1057,7 +1057,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
|||||||
|
|
||||||
/* walk through options */
|
/* walk through options */
|
||||||
for (p = bv; *p != NULL; p++) {
|
for (p = bv; *p != NULL; p++) {
|
||||||
if ((var = strdup((*p)->bv_val)) == NULL) {
|
if ((copy = var = strdup((*p)->bv_val)) == NULL) {
|
||||||
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@@ -1102,7 +1102,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
|||||||
/* case var Boolean True */
|
/* case var Boolean True */
|
||||||
set_default(var, NULL, true);
|
set_default(var, NULL, true);
|
||||||
}
|
}
|
||||||
free(var);
|
free(copy);
|
||||||
}
|
}
|
||||||
rc = true;
|
rc = true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user