From: Howard Chu Date: Tue, 6 Sep 2011 21:04:38 +0000 (-0700) Subject: Fix 6c8e4f2 for empty suffixes X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9dc1b05f3023abee5fb39b3c9ad6239c1b5c4717;p=openldap Fix 6c8e4f2 for empty suffixes --- 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);