From 0b48876e1a4c98f86b1adf8975d0a5f34e0a6e60 Mon Sep 17 00:00:00 2001 From: Martijn van Duren Date: Tue, 6 Nov 2018 14:15:30 +0000 Subject: Fix base64 outlen calculation. OK claudio@ --- usr.bin/ldap/ldapclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.bin') 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 @@ -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) { -- cgit v1.2.3