mirror of
https://github.com/curl/curl.git
synced 2026-08-26 09:53:32 +03:00
base64: better alloc size
The previous algorithm allocated more bytes than necessary. Suggested-by: xtonik on github Fixes #10024 Closes #10025
This commit is contained in:
parent
29bb9ba431
commit
fa467a2fa9
1 changed files with 1 additions and 1 deletions
|
|
@ -192,7 +192,7 @@ static CURLcode base64_encode(const char *table64,
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
base64data = output = malloc(insize * 4 / 3 + 4);
|
base64data = output = malloc((insize + 2) / 3 * 4 + 1);
|
||||||
if(!output)
|
if(!output)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue