1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

AK+Everywhere: Make Base64 decoding fallible

This commit is contained in:
Ben Wiederhake 2021-10-23 15:43:59 +02:00 committed by Linus Groh
parent 3bf1f7ae87
commit cb868cfa41
Notes: sideshowbarker 2024-07-18 01:57:56 +09:00
11 changed files with 73 additions and 32 deletions

View file

@ -197,7 +197,10 @@ Optional<HttpRequest::BasicAuthenticationCredentials> HttpRequest::parse_http_ba
auto token = value.substring_view(6);
if (token.is_empty())
return {};
auto decoded_token = String::copy(decode_base64(token));
auto decoded_token_bb = decode_base64(token);
if (!decoded_token_bb.has_value())
return {};
auto decoded_token = String::copy(decoded_token_bb.value());
auto colon_index = decoded_token.find(':');
if (!colon_index.has_value())
return {};