diff options
Diffstat (limited to 'Userland/Utilities/base64.cpp')
-rw-r--r-- | Userland/Utilities/base64.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Utilities/base64.cpp b/Userland/Utilities/base64.cpp index 21e4dc04f5..e08e025509 100644 --- a/Userland/Utilities/base64.cpp +++ b/Userland/Utilities/base64.cpp @@ -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; } |