summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2018-11-06 14:15:29 +0000
committermartijn <martijn@openbsd.org>2018-11-06 14:15:29 +0000
commit3d35bc600d992f7ee439edd39ec8a538862e9443 (patch)
tree1ae99fc7e5b3ded7224bd8e2c5bb7bddf927f438
parentImplement SAFE-INIT-CHAR. (diff)
downloadwireguard-openbsd-3d35bc600d992f7ee439edd39ec8a538862e9443.tar.xz
wireguard-openbsd-3d35bc600d992f7ee439edd39ec8a538862e9443.zip
Fix base64 outlen calculation.
OK claudio@
-rw-r--r--usr.bin/ldap/ldapclient.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ldap/ldapclient.c b/usr.bin/ldap/ldapclient.c
index 98c98085773..51a6c51e487 100644
--- a/usr.bin/ldap/ldapclient.c
+++ b/usr.bin/ldap/ldapclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapclient.c,v 1.6 2018/11/06 14:14:12 martijn Exp $ */
+/* $OpenBSD: ldapclient.c,v 1.7 2018/11/06 14:15:29 martijn Exp $ */
/*
* Copyright (c) 2018 Reyk Floeter <reyk@openbsd.org>
@@ -426,7 +426,7 @@ ldapc_printattr(struct ldapc *ldap, const char *key, const char *value)
}
} else {
inlen = strlen(value);
- outlen = inlen * 2 + 1;
+ outlen = (((inlen + 2) / 3) * 4) + 1;
if ((out = calloc(1, outlen)) == NULL ||
b64_ntop(value, inlen, out, outlen) == -1) {