summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2018-11-06 14:15:30 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2018-11-06 14:15:30 +0000
commit0b48876e1a4c98f86b1adf8975d0a5f34e0a6e60 (patch)
tree360b4d43ba80f3e655e94701269778141ebe3bbf /usr.bin
parent0eb1f5735cc1d9eb6ac470444c156dcc46846df7 (diff)
Fix base64 outlen calculation.
OK claudio@
Diffstat (limited to 'usr.bin')
-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) {