From 31fcc4fc6dc16f48815b304d3718c94e3ca5032b Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 7 Apr 2019 00:38:51 +0200 Subject: [PATCH] Fix the buffer size in the getBytesFromStream function --- src/de/mas/wiiu/jnus/utils/StreamUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/de/mas/wiiu/jnus/utils/StreamUtils.java b/src/de/mas/wiiu/jnus/utils/StreamUtils.java index e0f7d65..23486c7 100644 --- a/src/de/mas/wiiu/jnus/utils/StreamUtils.java +++ b/src/de/mas/wiiu/jnus/utils/StreamUtils.java @@ -35,7 +35,12 @@ public final class StreamUtils { public static byte[] getBytesFromStream(InputStream in, int size) throws IOException { synchronized (in) { byte[] result = new byte[size]; - byte[] buffer = new byte[0x8000]; + byte[] buffer = null; + if (size < 0x8000) { + buffer = new byte[size]; + } else { + buffer = new byte[0x8000]; + } int totalRead = 0; do { int read = in.read(buffer);