]> git.sur5r.net Git - openldap/commitdiff
make sure the DN is null-terminated before normalizing it
authorPierangelo Masarati <ando@openldap.org>
Thu, 6 Feb 2003 19:15:14 +0000 (19:15 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 6 Feb 2003 19:15:14 +0000 (19:15 +0000)
servers/slapd/sasl.c

index 228a9d8061bcdb402047d77351745d9c65fe4a90..a60fc0454da0c45f0b5b429a8c8af845f7016c3e 100644 (file)
@@ -1664,11 +1664,16 @@ int slap_sasl_getdn( Connection *conn, char *id, int len,
 
        /* All strings are in DN form now. Normalize if needed. */
        if ( do_norm ) {
+               if ( is_dn != SET_U ) {
+                       struct berval dntmp;
+                       
+                       ber_dupbv( &dntmp, dn );
+                       dn->bv_val = dntmp.bv_val;
+               }
                rc = dnNormalize2( NULL, dn, &dn2 );
 
                /* User DNs were constructed above and must be freed now */
-               if ( is_dn == SET_U )
-                       ch_free( dn->bv_val );
+               ch_free( dn->bv_val );
 
                if ( rc != LDAP_SUCCESS ) {
                        dn->bv_val = NULL;