From ab68c7571737ff069cdda8cda818ffba33d76f2c Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 23 Sep 2006 16:11:06 +0000 Subject: [PATCH] fix potential double free in case of error --- CHANGES | 1 + libraries/librewrite/map.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index dd448def69..ff6971b796 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ OpenLDAP 2.3 Change Log OpenLDAP 2.3.28 Engineering Fixed libldap ldap.conf max line length (ITS#4669) Fixed librewrite LDAP map parsing bug + Fixed librewrite map double free bug Added ldapsearch bad filter pattern check (ITS#4647) Fixed slapd-monitor locking with scope "subordinate" (ITS#4668) Fixed slapd global access controls initialization (ITS#4654) diff --git a/libraries/librewrite/map.c b/libraries/librewrite/map.c index d82729f5ab..edae3114f5 100644 --- a/libraries/librewrite/map.c +++ b/libraries/librewrite/map.c @@ -354,7 +354,12 @@ rewrite_map_apply( ( struct rewrite_context * )map->lm_data, key->bv_val, &val->bv_val ); if ( val->bv_val != NULL ) { - val->bv_len = strlen( val->bv_val ); + if ( val->bv_val == key->bv_val ) { + val->bv_len = key->bv_len; + key->bv_val = NULL; + } else { + val->bv_len = strlen( val->bv_val ); + } } break; -- 2.39.5