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: Henrik Brix Andersen <hebad@vestas.com> (cherry picked from commit 1b3d1e01deff942ef84cb08e9fa9b4c5e18de385)
diff --git a/subsys/canbus/isotp/isotp.c b/subsys/canbus/isotp/isotp.c index 58918a0..5cc2b56 100644 --- a/subsys/canbus/isotp/isotp.c +++ b/subsys/canbus/isotp/isotp.c
@@ -907,7 +907,11 @@ 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