Fix out of bounds read in base64_decode

This commit is contained in:
Matt Eastman 2018-10-03 17:24:11 -05:00
parent 64de7b6f1d
commit 8cb5ea3d5e
2 changed files with 15 additions and 1 deletions

View file

@ -200,7 +200,7 @@ inline std::string base64_decode(const char* in, size_t len)
constexpr static const DMap dmap{};
while (dmap.at(in[bytes_rem - 1]) == -1) { bytes_rem--; }
while (bytes_rem > 0 && dmap.at(in[bytes_rem - 1]) == -1) { bytes_rem--; }
while (bytes_rem > 4)
{