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>
This commit is contained in:
parent
03905f7e55
commit
1b3d1e01de
1 changed files with 5 additions and 1 deletions
|
@ -881,7 +881,11 @@ static inline int send_sf(struct isotp_send_ctx *ctx)
|
||||||
|
|
||||||
frame.data[index++] = ISOTP_PCI_TYPE_SF | len;
|
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);
|
memcpy(&frame.data[index], data, len);
|
||||||
|
|
||||||
#ifdef CONFIG_ISOTP_ENABLE_TX_PADDING
|
#ifdef CONFIG_ISOTP_ENABLE_TX_PADDING
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue