]> git.sur5r.net Git - openldap/commitdiff
Fix 6c8e4f2 for empty suffixes
authorHoward Chu <hyc@openldap.org>
Tue, 6 Sep 2011 21:04:38 +0000 (14:04 -0700)
committerHoward Chu <hyc@openldap.org>
Tue, 6 Sep 2011 21:04:38 +0000 (14:04 -0700)
servers/slapd/back-mdb/search.c

index 53a849c4f2708e17475fe5eb7bae45d4d43a1bc3..101e955f4f440b0093032e4de3dda056cbca67b1 100644 (file)
@@ -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);