diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2018-10-23 08:24:51 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2018-10-23 08:24:51 +0000 |
commit | 053da1d148d13b8ba5bdcf110917f823c3e756b3 (patch) | |
tree | 821f0da070e0212b0dca1299c08ad37881a67e6f /usr.bin/ldap | |
parent | f059819f3168da5ac9eda2faed48f55c2b44a449 (diff) |
Fix off by one when wrapping long LDIF lines.
OK reyk@
Diffstat (limited to 'usr.bin/ldap')
-rw-r--r-- | usr.bin/ldap/ldapclient.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ldap/ldapclient.c b/usr.bin/ldap/ldapclient.c index b536eb7bde8..6fbf7753934 100644 --- a/usr.bin/ldap/ldapclient.c +++ b/usr.bin/ldap/ldapclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapclient.c,v 1.3 2018/07/03 10:10:09 jmc Exp $ */ +/* $OpenBSD: ldapclient.c,v 1.4 2018/10/23 08:24:50 martijn Exp $ */ /* * Copyright (c) 2018 Reyk Floeter <reyk@openbsd.org> @@ -440,9 +440,11 @@ ldapc_printattr(struct ldapc *ldap, const char *key, const char *value) /* Wrap lines */ for (outlen = 0, inlen = strlen(p); outlen < inlen; - outlen += LDIF_LINELENGTH) { + outlen += LDIF_LINELENGTH - 1) { if (outlen) putchar(' '); + if (outlen > LDIF_LINELENGTH) + outlen--; /* max. line length - newline - optional indent */ left = MIN(inlen - outlen, outlen ? LDIF_LINELENGTH - 2 : |