summaryrefslogtreecommitdiffstats
path: root/lib/base64.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2016-11-02 06:34:06 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-05 16:39:32 (GMT)
commit93cc249f3dd7ecd621cd063e4c08bbdb54d971e8 (patch)
tree4cd65530c3a67921921256010ae5ef0a61596e40 /lib/base64.c
parent202adcfe056681109fe61569ecdb3bd69f0b4f97 (diff)
downloadCMake-93cc249f3dd7ecd621cd063e4c08bbdb54d971e8.zip
CMake-93cc249f3dd7ecd621cd063e4c08bbdb54d971e8.tar.gz
CMake-93cc249f3dd7ecd621cd063e4c08bbdb54d971e8.tar.bz2
curl 2016-11-02 (3c561c65)
Code extracted from: https://github.com/curl/curl.git at commit 3c561c657c2f0e553b19115a506592a8bbd744bc (curl-7_51_0).
Diffstat (limited to 'lib/base64.c')
-rw-r--r--lib/base64.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/base64.c b/lib/base64.c
index ad25459..204a227 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -190,6 +190,11 @@ static CURLcode base64_encode(const char *table64,
if(!insize)
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);
if(!output)
return CURLE_OUT_OF_MEMORY;