Skip to content

Commit 324938b

Browse files
jfischer-noioannisg
authored andcommitted
drivers: eth_enc424j600: check received frame length
Check received frame length. Fixes: #20493 Coverity-CID: 205668 Signed-off-by: Johann Fischer <[email protected]>
1 parent 6eb4808 commit 324938b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/ethernet/eth_enc424j600.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ static int enc424j600_rx(struct device *dev)
374374
context->next_pkt_ptr, frm_len, status);
375375
/* frame length without FCS */
376376
frm_len -= 4;
377+
if (frm_len > NET_ETH_MAX_FRAME_SIZE) {
378+
LOG_ERR("Maximum frame length exceeded");
379+
eth_stats_update_errors_rx(context->iface);
380+
goto done;
381+
}
377382

378383
/* Get the frame from the buffer */
379384
pkt = net_pkt_rx_alloc_with_buffer(context->iface, frm_len,

0 commit comments

Comments
 (0)