diff options
author | claudio <claudio@openbsd.org> | 2020-03-27 12:46:00 +0000 |
---|---|---|
committer | claudio <claudio@openbsd.org> | 2020-03-27 12:46:00 +0000 |
commit | d6e113dfa131ed9e29c9bdc82fd6ac01a2cad7ac (patch) | |
tree | 4f30410fb922b525e7c6fc85161082980ae6a12f /usr.sbin/rpki-client | |
parent | BD71837 uses the same BUCK2 register as BD71847. This allows (diff) | |
download | wireguard-openbsd-d6e113dfa131ed9e29c9bdc82fd6ac01a2cad7ac.tar.xz wireguard-openbsd-d6e113dfa131ed9e29c9bdc82fd6ac01a2cad7ac.zip |
Use the correct math to calculate how many bytes are needed for b64_pton().
The size is first rounded up in case where the input string length is not
a multiple of 4.
Reported by kristaps@
Diffstat (limited to 'usr.sbin/rpki-client')
-rw-r--r-- | usr.sbin/rpki-client/tal.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/rpki-client/tal.c b/usr.sbin/rpki-client/tal.c index b5e8f5b2963..d66cdba9d04 100644 --- a/usr.sbin/rpki-client/tal.c +++ b/usr.sbin/rpki-client/tal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tal.c,v 1.16 2019/11/29 17:29:28 benno Exp $ */ +/* $OpenBSD: tal.c,v 1.17 2020/03/27 12:46:00 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -107,7 +107,7 @@ tal_parse_buffer(const char *fn, char *buf) } /* Now the BASE64-encoded public key. */ - sz = ((sz + 2) / 3) * 4 + 1; + sz = ((sz + 3) / 4) * 3 + 1; if ((b64 = malloc(sz)) == NULL) err(1, NULL); if ((b64sz = b64_pton(buf, b64, sz)) < 0) |