From fa8e07169bfea3bbd20916192bcdd28373a11c46 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 10 May 2020 02:56:00 +0300 Subject: [PATCH] He just told me that 'NXDT_COMMAND_HEADER_SIZE was added to reflect the UsbCommandHeader struct from my codebase. No received command should ever be smaller than this. NXDT_COMMAND_SIZE was renamed to NXDT_MAX_COMMAND_SIZE for this reason.' --- src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java b/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java index 88ece45..10dd560 100644 --- a/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java +++ b/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java @@ -41,7 +41,7 @@ class NxdtUsbAbi1 { private boolean isWindows; - private static final int NXDT_COMMAND_SIZE = 0x1000; + private static final int NXDT_MAX_COMMAND_SIZE = 0x1000; private static final int NXDT_FILE_CHUNK_SIZE = 0x800000; private static final byte ABI_VERSION = 1; @@ -291,7 +291,7 @@ class NxdtUsbAbi1 { * 'null' if read failed * */ private byte[] readUsbDirective() throws Exception{ - ByteBuffer readBuffer = ByteBuffer.allocateDirect(NXDT_COMMAND_SIZE); + ByteBuffer readBuffer = ByteBuffer.allocateDirect(NXDT_MAX_COMMAND_SIZE); // We can limit it to 32 bytes, but there is a non-zero chance to got OVERFLOW from libusb. IntBuffer readBufTransferred = IntBuffer.allocate(1); int result;