Commit 11a493c8 authored by Henrik Brix Andersen's avatar Henrik Brix Andersen Committed by Fabio Baltieri
Browse files

canbus: isotp: convert SF length check from ASSERT to runtime check

Convert the ISO-TP SF length check in send_sf() from __ASSERT() to a
runtime check.

Fixes: #61501

Signed-off-by: default avatarHenrik Brix Andersen <hebad@vestas.com>
(cherry picked from commit 1b3d1e01)
parent 099e0132
Loading
Loading
Loading
Loading
+5 −1
Changes for subsys/canbus/isotp/isotp.c: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -880,7 +880,11 @@ static inline int send_sf(struct isotp_send_ctx *ctx)

	frame.data[index++] = ISOTP_PCI_TYPE_SF | len;

	__ASSERT_NO_MSG(len <= ISOTP_CAN_DL - index);
	if (len > ISOTP_CAN_DL - index) {
		LOG_ERR("SF len does not fit DL");
		return -ENOSPC;
	}

	memcpy(&frame.data[index], data, len);

#ifdef CONFIG_ISOTP_ENABLE_TX_PADDING