mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
base64: check for integer overflow on large input
CVE-2016-8617 Bug: https://curl.haxx.se/docs/adv_20161102C.html Reported-by: Cure53
This commit is contained in:
parent
3d6460edee
commit
efd24d5742
@ -190,6 +190,11 @@ static CURLcode base64_encode(const char *table64,
|
|||||||
if(!insize)
|
if(!insize)
|
||||||
insize = strlen(indata);
|
insize = strlen(indata);
|
||||||
|
|
||||||
|
#if SIZEOF_SIZE_T == 4
|
||||||
|
if(insize > UINT_MAX/4)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
#endif
|
||||||
|
|
||||||
base64data = output = malloc(insize * 4 / 3 + 4);
|
base64data = output = malloc(insize * 4 / 3 + 4);
|
||||||
if(!output)
|
if(!output)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
Loading…
Reference in New Issue
Block a user