Fix NXDT_FILE_PROPERTIES_MAX_NAME_LENGTH validation

This commit is contained in:
Dmitry Isaenko 2020-05-10 20:31:44 +03:00
parent 0848d43bc9
commit 1c6a7a094d

View file

@ -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;