mirror of
https://github.com/fmang/opustags.git
synced 2025-01-28 10:55:06 +01:00
Fix string out-of-bounds access
This commit is contained in:
parent
a54bac8f55
commit
76afc0efd5
@ -56,7 +56,7 @@ std::u8string ot::encode_base64(ot::byte_string_view src)
|
||||
ot::byte_string ot::decode_base64(std::u8string_view src)
|
||||
{
|
||||
// Remove the padding and rely on the string length instead.
|
||||
while (src.back() == u8'=')
|
||||
while (!src.empty() && src.back() == u8'=')
|
||||
src.remove_suffix(1);
|
||||
|
||||
size_t olen = src.size() / 4 * 3; // Whole blocks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user