From a58c1c5b7758cece399f6d52c797449edb640f87 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 24 Apr 2019 13:27:02 +0200 Subject: [PATCH] Make sure to always read the expected Blocksize from a stream of a hashed content. --- src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java b/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java index c8b46d2..2c98878 100644 --- a/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java +++ b/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java @@ -212,6 +212,10 @@ public class NUSDecryption extends AESDecryption { inBlockBuffer = StreamUtils.getChunkFromStream(inputStream, encryptedBlockBuffer, overflow, BLOCKSIZE); if (writeSize > filesize) writeSize = filesize; + if (inBlockBuffer != BLOCKSIZE) { + throw new IOException("wasn't able to read " + BLOCKSIZE); + } + byte[] output; try { output = decryptFileChunkHash(encryptedBlockBuffer, (int) block, contentIndex, h3Hash);