Skip to content

Commit 1bf9303

Browse files
authored
Merge pull request #12457 from artokin/update_stm32_emac_ethernet_driver
Update STM32 EMAC driver - limit RX frame length
2 parents 1f36b1c + da04cc3 commit 1bf9303

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ bool STM32_EMAC::link_out(emac_mem_buf_t *buf)
520520
int STM32_EMAC::low_level_input(emac_mem_buf_t **buf)
521521
#ifndef ETH_IP_VERSION_V2
522522
{
523-
uint16_t len = 0;
523+
uint32_t len = 0;
524524
uint8_t *buffer;
525525
__IO ETH_DMADescTypeDef *dmarxdesc;
526526
uint32_t bufferoffset = 0;
@@ -540,7 +540,7 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf)
540540

541541
dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc;
542542

543-
if (len > 0) {
543+
if (len > 0 && len <= ETH_RX_BUF_SIZE) {
544544
/* Allocate a memory buffer chain from buffer pool */
545545
*buf = memory_manager->alloc_pool(len, 0);
546546
}

0 commit comments

Comments
 (0)