Skip to content
Snippets Groups Projects
Commit 046ad875 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

base64: check input size

Change-Id: I81534f04f0f4606b6b58e7962a67ae165f86b846
parent 2026e4d2
Branches
No related tags found
No related merge requests found
......@@ -28,10 +28,10 @@ namespace base64 {
std::string
encode(std::string_view dat)
{
if (dat.empty())
if (dat.empty() || dat.size() > INT_MAX)
return {};
int input_length = dat.size();
int input_length = (int)dat.size();
int output_length = PJ_BASE256_TO_BASE64_LEN(input_length);
std::string out;
out.resize(output_length);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment