From c7142fdec56a6e9af0ce0734ef6909dc844927ba Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 1 May 2009 04:26:44 +0000 Subject: [PATCH] Don't underflow malloc'd memory in hdb_fix_dn() --- servers/slapd/back-bdb/dn2id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.39.5