From fff7fbe1217a361194499bb80d84ee25db1e58e7 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 3 Oct 2014 15:11:29 +0000 Subject: [PATCH] Base64: Catch NPE on bad input to main() decode --- core/java/src/net/i2p/data/Base64.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/src/net/i2p/data/Base64.java b/core/java/src/net/i2p/data/Base64.java index 578dadda25..2a30d3631a 100644 --- a/core/java/src/net/i2p/data/Base64.java +++ b/core/java/src/net/i2p/data/Base64.java @@ -264,6 +264,8 @@ public class Base64 { private static void decode(InputStream in, OutputStream out) throws IOException { byte decoded[] = decode(new String(read(in))); + if (decoded == null) + throw new IOException("Invalid base 64 string"); out.write(decoded); } -- GitLab