check if eth rx packet is overflow

This commit is contained in:
sakumisu
2024-05-03 19:19:17 +08:00
parent 7ebcafe158
commit ae5a9d1e57
5 changed files with 29 additions and 9 deletions

View File

@@ -711,6 +711,10 @@ find_class:
USB_LOG_ERR("No memory to alloc pbuf for asix rx\r\n");
}
} else {
if (g_asix_rx_length > CONFIG_USBHOST_ASIX_ETH_MAX_SEGSZE) {
USB_LOG_ERR("Rx packet is overflow\r\n");
g_asix_rx_length = 0;
}
}
}
// clang-format off

View File

@@ -2199,6 +2199,10 @@ find_class:
}
}
} else {
if (g_rtl8152_rx_length > CONFIG_USBHOST_RTL8152_ETH_MAX_RX_SEGSZE) {
USB_LOG_ERR("Rx packet is overflow\r\n");
g_rtl8152_rx_length = 0;
}
}
}
// clang-format off