From: Pierangelo Masarati Date: Thu, 6 Feb 2003 19:15:14 +0000 (+0000) Subject: make sure the DN is null-terminated before normalizing it X-Git-Tag: NO_SLAP_OP_BLOCKS~425 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9f28f1234687a180c73e1b1fc9a41b680a063bda;p=openldap make sure the DN is null-terminated before normalizing it --- 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;