summaryrefslogtreecommitdiff
path: root/sshbuf-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshbuf-misc.c')
-rw-r--r--sshbuf-misc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sshbuf-misc.c b/sshbuf-misc.c
index 15dcfbc79..a077a01ef 100644
--- a/sshbuf-misc.c
+++ b/sshbuf-misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf-misc.c,v 1.6 2016/05/02 08:49:03 djm Exp $ */ 1/* $OpenBSD: sshbuf-misc.c,v 1.7 2019/07/07 01:05:00 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -95,14 +95,13 @@ sshbuf_dtob64(struct sshbuf *buf)
95 size_t len = sshbuf_len(buf), plen; 95 size_t len = sshbuf_len(buf), plen;
96 const u_char *p = sshbuf_ptr(buf); 96 const u_char *p = sshbuf_ptr(buf);
97 char *ret; 97 char *ret;
98 int r;
99 98
100 if (len == 0) 99 if (len == 0)
101 return strdup(""); 100 return strdup("");
102 plen = ((len + 2) / 3) * 4 + 1; 101 plen = ((len + 2) / 3) * 4 + 1;
103 if (SIZE_MAX / 2 <= len || (ret = malloc(plen)) == NULL) 102 if (SIZE_MAX / 2 <= len || (ret = malloc(plen)) == NULL)
104 return NULL; 103 return NULL;
105 if ((r = b64_ntop(p, len, ret, plen)) == -1) { 104 if (b64_ntop(p, len, ret, plen) == -1) {
106 explicit_bzero(ret, plen); 105 explicit_bzero(ret, plen);
107 free(ret); 106 free(ret);
108 return NULL; 107 return NULL;