From 62955cd1be7b53cad079ed63f0a6fb82525686de Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Sun, 2 Aug 2009 23:12:55 +0000
Subject: [PATCH] ITS#6233

---
 CHANGES                | 1 +
 clients/tools/common.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGES b/CHANGES
index 8b317ed4b6..7dba74a5b2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,7 @@ OpenLDAP 2.4.18 Engineering
 	Fixed slapd tools to properly close database (ITS#6214)
 	Fixed slapd-ndb startup (ITS#6203)
 	Fixed slapo-unique filter matching (ITS#6077)
+	Fixed tools off by one error (ITS#6233)
 	Fixed tools resource leaks (ITS#6145)
 	Fixed contrib/autogroup with RE24 (ITS#6227)
 	Build Environment
diff --git a/clients/tools/common.c b/clients/tools/common.c
index a75f8bfe98..c39b9c1a21 100644
--- a/clients/tools/common.c
+++ b/clients/tools/common.c
@@ -2049,7 +2049,7 @@ print_deref( LDAP *ld, LDAPControl *ctrl )
 		}
 		ptr = lutil_strncopy( ptr, dr->derefVal.bv_val, dr->derefVal.bv_len );
 		*ptr++ = '\n';
-		*ptr++ = '\0';
+		*ptr = '\0';
 		assert( ptr <= buf + len );
 
 		tool_write_ldif( LDIF_PUT_COMMENT, NULL, buf, ptr - buf);
-- 
GitLab