From: Howard Chu Date: Fri, 1 May 2009 04:26:44 +0000 (+0000) Subject: Don't underflow malloc'd memory in hdb_fix_dn() X-Git-Tag: ACLCHECK_0~582 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c7142fdec56a6e9af0ce0734ef6909dc844927ba;p=openldap Don't underflow malloc'd memory in hdb_fix_dn() --- diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index 7a022db165..f4c528fa48 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -529,8 +529,8 @@ int hdb_fix_dn( } } BEI(e)->bei_modrdns = max; - ptr[-1] = '\0'; - nptr[-1] = '\0'; + if ( ptr > e->e_name.bv_val ) ptr[-1] = '\0'; + if ( nptr > e->e_nname.bv_val ) nptr[-1] = '\0'; return 0; }