ldap/servers/plugins/mep/mep.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 6d7ddbb4c2e565bf9e4dc24726a45467fd7159f2
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Tue Dec 7 13:47:30 2010 -0800
Bug 658312 - Invalid free in Managed Entry plug-in
The previous patch for bug 658312 would perform an invalid free
with a mapping rule used the $dn macro. We get the DN of the
origin entry with slapi_entry_get_ndn(). The returned value is
not supposed to be freed. This patch adds a flag to indicate it
we need to perform a free of the mapping value or not.
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index 16c2e41..df4821a 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -1436,19 +1436,23 @@ mep_parse_mapped_attr(char *mapping, Slapi_Entry *origin,
if (map_type) {
if (origin) {
char *map_val = NULL;
+ int freeit = 0;
/* If the map type is dn, fetch the origin dn. */
if (slapi_attr_type_cmp(map_type, "dn", SLAPI_TYPE_CMP_EXACT) == 0)
{
map_val = slapi_entry_get_ndn(origin);
} else {
map_val = slapi_entry_attr_get_charptr(origin, map_type);
+ freeit = 1;
}
if (map_val) {
/* Create the new mapped value. */
*value = slapi_ch_smprintf("%s%s%s", pre_str,
map_val, post_str);
- slapi_ch_free_string(&map_val);
+ if (freeit) {
+ slapi_ch_free_string(&map_val);
+ }
} else {
slapi_log_error( SLAPI_LOG_FATAL, MEP_PLUGIN_SUBSYSTEM,
"mep_parse_mapped_attr: Mapped attribute \"%s\"
"
Show replies by date