mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
AK+Everywhere: Make Base64 decoding fallible
This commit is contained in:
parent
3bf1f7ae87
commit
cb868cfa41
11 changed files with 73 additions and 32 deletions
|
@ -51,7 +51,11 @@ int main(int argc, char** argv)
|
|||
|
||||
if (decode) {
|
||||
auto decoded = decode_base64(StringView(buffer));
|
||||
fwrite(decoded.data(), sizeof(u8), decoded.size(), stdout);
|
||||
if (!decoded.has_value()) {
|
||||
warnln("base64: invalid input");
|
||||
return 1;
|
||||
}
|
||||
fwrite(decoded.value().data(), sizeof(u8), decoded.value().size(), stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue