From 9dc1b05f3023abee5fb39b3c9ad6239c1b5c4717 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 6 Sep 2011 14:04:38 -0700 Subject: [PATCH] Fix 6c8e4f2 for empty suffixes --- servers/slapd/back-mdb/search.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-mdb/search.c b/servers/slapd/back-mdb/search.c index 53a849c4f2..101e955f4f 100644 --- a/servers/slapd/back-mdb/search.c +++ b/servers/slapd/back-mdb/search.c @@ -734,8 +734,15 @@ loop_begin: n += isc.nrdns[i].bv_len; *n++ = ','; } - memcpy(d, pdn.bv_val, pdn.bv_len+1); - memcpy(n, pndn.bv_val, pndn.bv_len+1); + if (pdn.bv_len) { + memcpy(d, pdn.bv_val, pdn.bv_len+1); + memcpy(n, pndn.bv_val, pndn.bv_len+1); + } else { + *--d = '\0'; + *--n = '\0'; + e->e_name.bv_len--; + e->e_nname.bv_len--; + } if (isc.nscope != 1) { op->o_tmpfree(pndn.bv_val, op->o_tmpmemctx); op->o_tmpfree(pdn.bv_val, op->o_tmpmemctx); -- 2.39.5