]> git.sur5r.net Git - openldap/commitdiff
fix potential double free in case of error
authorPierangelo Masarati <ando@openldap.org>
Sat, 23 Sep 2006 16:11:06 +0000 (16:11 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 23 Sep 2006 16:11:06 +0000 (16:11 +0000)
CHANGES
libraries/librewrite/map.c

diff --git a/CHANGES b/CHANGES
index dd448def6932c121b385926c9fcecad53b195582..ff6971b796728600343d0b373cd4c54cfa09d305 100644 (file)
--- 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)
index d82729f5abe70c8bd8861bb1bf2f3bc320c34f50..edae3114f5184290b013f7f318ba66d5a974f351 100644 (file)
@@ -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;