diff --git a/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp b/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp old mode 100644 new mode 100755 index a13e4d124c..6935b157ef --- a/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp @@ -526,7 +526,7 @@ error: int STM32_EMAC::low_level_input(emac_mem_buf_t **buf) #ifndef ETH_IP_VERSION_V2 { - uint16_t len = 0; + uint32_t len = 0; uint8_t *buffer; __IO ETH_DMADescTypeDef *dmarxdesc; uint32_t bufferoffset = 0; @@ -546,7 +546,7 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf) dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc; - if (len > 0) { + if (len > 0 && len <= ETH_RX_BUF_SIZE) { /* Allocate a memory buffer chain from buffer pool */ *buf = memory_manager->alloc_pool(len, 0); }