From 1c6a7a094d5b78fc5ecad56c1b887b0dd839f668 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 10 May 2020 20:31:44 +0300 Subject: [PATCH] Fix NXDT_FILE_PROPERTIES_MAX_NAME_LENGTH validation --- src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java b/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java index 11299a1..afea175 100644 --- a/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java +++ b/src/main/java/nsusbloader/Utilities/NxdtUsbAbi1.java @@ -184,7 +184,7 @@ class NxdtUsbAbi1 { final int fileNameLen = getLEint(message, 0x18); String filename = new String(message, 0x20, fileNameLen, StandardCharsets.UTF_8); - if (fileNameLen == 0 || fileNameLen > NXDT_FILE_PROPERTIES_MAX_NAME_LENGTH){ + if (fileNameLen <= 0 || fileNameLen > NXDT_FILE_PROPERTIES_MAX_NAME_LENGTH){ writeUsb(USBSTATUS_MALFORMED_REQUEST); logPrinter.print("Invalid filename length!", EMsgType.FAIL); return;