🐛 fixed buffer size

This commit is contained in:
EntireTwix 2021-07-09 18:13:53 -07:00
parent 2fe00e05de
commit db5a54175c

View file

@ -9,12 +9,12 @@ void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &re
FilterChainCallback &&fccb)
{
std::string_view auth_header = req->getHeader("Authorization");
if (auth_header.size() > 6 && auth_header.size() <= 517) //"Basic " + username + ':' + password
if (auth_header.size() > 6 && auth_header.size() <= 688) //"Basic " + (username + ':' + password) * 4/3
{
if (auth_header.substr(0, 6) == "Basic ")
{
std::string_view base64_input = auth_header.substr(6);
std::array<char, 384> base64_result; //(255 username + ':' + 255 password) * 3/4
std::array<char, 511> base64_result; //(255 username + ':' + 255 password)
size_t new_sz;
base64_decode(base64_input.data(), base64_input.size(), base64_result.begin(), &new_sz, 0);