diff --git a/mcp2515.cpp b/mcp2515.cpp index 833a133..88c91b2 100644 --- a/mcp2515.cpp +++ b/mcp2515.cpp @@ -573,6 +573,10 @@ MCP2515::ERROR MCP2515::setFilter(const RXF num, const bool ext, const uint32_t MCP2515::ERROR MCP2515::sendMessage(const TXBn txbn, const struct can_frame *frame) { + if (frame->can_dlc > CAN_MAX_DLEN) { + return ERROR_FAILTX; + } + const struct TXBn_REGS *txbuf = &TXB[txbn]; uint8_t data[13];