mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-06 15:10:22 -05:00
Fix crasher in slapi_dn_issuffix() when malformed DNs are passed
This commit is contained in:
parent
8429210bed
commit
3b5f98723c
1 changed files with 15 additions and 3 deletions
|
|
@ -902,6 +902,7 @@ slapi_dn_issuffix(
|
|||
#ifdef LDAP_SLAPI
|
||||
struct berval bdn, ndn;
|
||||
struct berval bsuffix, nsuffix;
|
||||
int rc;
|
||||
|
||||
assert( dn != NULL );
|
||||
assert( suffix != NULL );
|
||||
|
|
@ -912,10 +913,21 @@ slapi_dn_issuffix(
|
|||
bsuffix.bv_val = suffix;
|
||||
bsuffix.bv_len = strlen( suffix );
|
||||
|
||||
dnNormalize2( NULL, &bdn, &ndn );
|
||||
dnNormalize2( NULL, &bsuffix, &nsuffix );
|
||||
if ( dnNormalize2( NULL, &bdn, &ndn ) != LDAP_SUCCESS ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return dnIsSuffix( &ndn, &nsuffix );
|
||||
if ( dnNormalize2( NULL, &bsuffix, &nsuffix ) != LDAP_SUCCESS ) {
|
||||
slapi_ch_free( (void **)&ndn.bv_val );
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = dnIsSuffix( &ndn, &nsuffix );
|
||||
|
||||
slapi_ch_free( (void **)&ndn.bv_val );
|
||||
slapi_ch_free( (void **)&nsuffix.bv_val );
|
||||
|
||||
return rc;
|
||||
#else /* LDAP_SLAPI */
|
||||
return 0;
|
||||
#endif /* LDAP_SLAPI */
|
||||
|
|
|
|||
Loading…
Reference in a new issue