From 76b6ecbf04ab012c359fc1f47732f0f7ce87aa54 Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Tue, 25 May 2021 17:23:41 -0400 Subject: [PATCH] CANPacket: Fix invalid length check This case is already checked above, and further was invalid since the length had already been translated to the numeric (0-64) value. --- communication/packet/canpacket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/communication/packet/canpacket.cpp b/communication/packet/canpacket.cpp index 50190f7..c790f8d 100644 --- a/communication/packet/canpacket.cpp +++ b/communication/packet/canpacket.cpp @@ -124,7 +124,7 @@ bool HardwareCANPacket::EncodeFromMessage(const CANMessage& message, std::vector const optional lenFromDLC = CANFD_DLCToLength(message.dlcOnWire); if (lenFromDLC.has_value() && *lenFromDLC != 0) { - if (*lenFromDLC < lengthNibble || *lenFromDLC > 0xF) { + if (*lenFromDLC < lengthNibble) { report(APIEvent::Type::MessageMaxLengthExceeded, APIEvent::Severity::Error); return false; }