From 145eaac1847a616b93c897142e7625365db5be00 Mon Sep 17 00:00:00 2001 From: ActoryOu Date: Thu, 17 Oct 2024 10:10:35 +0000 Subject: [PATCH] Fix buffer access issue in UT. --- test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c index 34c8839ac..f6fa11343 100644 --- a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c +++ b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c @@ -2404,8 +2404,8 @@ void test_prvProcessEthernetPacket_IPv4FrameType_NeedARPResolution( void ) struct xNetworkInterface xInterface; NetworkEndPoint_t xNetworkEndPoint = { 0 }; - pxNetworkBuffer->xDataLength = ipconfigTCP_MSS; - pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer; + pxNetworkBuffer->xDataLength = ipconfigTCP_MSS - ipIP_TYPE_OFFSET; + pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer + ipIP_TYPE_OFFSET; pxNetworkBuffer->pxInterface = &xInterface; pxNetworkBuffer->pxEndPoint = &xNetworkEndPoint; @@ -2442,8 +2442,8 @@ void test_prvProcessEthernetPacket_IPv6FrameType_NeedNDResolution( void ) struct xNetworkInterface xInterface; NetworkEndPoint_t xNetworkEndPoint = { 0 }; - pxNetworkBuffer->xDataLength = ipconfigTCP_MSS; - pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer; + pxNetworkBuffer->xDataLength = ipconfigTCP_MSS - ipIP_TYPE_OFFSET; + pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer + ipIP_TYPE_OFFSET; pxNetworkBuffer->pxInterface = &xInterface; pxNetworkBuffer->pxEndPoint = &xNetworkEndPoint; @@ -2480,8 +2480,8 @@ void test_prvProcessEthernetPacket_IPv6FrameType_NeedNDResolution2( void ) struct xNetworkInterface xInterface; NetworkEndPoint_t xNetworkEndPoint = { 0 }; - pxNetworkBuffer->xDataLength = ipconfigTCP_MSS; - pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer; + pxNetworkBuffer->xDataLength = ipconfigTCP_MSS - ipIP_TYPE_OFFSET; + pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer + ipIP_TYPE_OFFSET; pxNetworkBuffer->pxInterface = &xInterface; pxNetworkBuffer->pxEndPoint = &xNetworkEndPoint;