From 9f28f1234687a180c73e1b1fc9a41b680a063bda Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 6 Feb 2003 19:15:14 +0000 Subject: [PATCH] make sure the DN is null-terminated before normalizing it --- servers/slapd/sasl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 228a9d8061..a60fc0454d 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -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;