diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-12-04 00:07:52 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-12-05 08:11:24 +0100 |
commit | fa467a2fa98f6420db55c3b359fb0beed574bbbf (patch) | |
tree | a3da66a524ce1cda1ca4ec3681597daefd8a4aa9 /lib/base64.c | |
parent | 29bb9ba431a3e3b44f131d7ef1668ae3305be2d1 (diff) | |
download | curl-fa467a2fa98f6420db55c3b359fb0beed574bbbf.tar.gz |
base64: better alloc size
The previous algorithm allocated more bytes than necessary.
Suggested-by: xtonik on github
Fixes #10024
Closes #10025
Diffstat (limited to 'lib/base64.c')
-rw-r--r-- | lib/base64.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/base64.c b/lib/base64.c index 52654c2bc..2760e7bbe 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -192,7 +192,7 @@ static CURLcode base64_encode(const char *table64, return CURLE_OUT_OF_MEMORY; #endif - base64data = output = malloc(insize * 4 / 3 + 4); + base64data = output = malloc((insize + 2) / 3 * 4 + 1); if(!output) return CURLE_OUT_OF_MEMORY; |