Skip to content

Commit 70065d8

Browse files
committed
Fix size_t underflow in ICMPv6 echo reply handler
prvProcessICMPMessage_IPv6() subtracted sizeof(ICMPEcho_IPv6_t) from the IPv6 Payload Length without checking that the payload is at least that large. When Payload Length is 0, the size_t subtraction wraps to SIZE_MAX, causing the verification loop to read far past the buffer. Add a minimum length check before the subtraction.
1 parent fc68874 commit 70065d8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

source/FreeRTOS_ND.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,11 @@
10811081
break;
10821082
}
10831083

1084+
if( uxDataLength < sizeof( *pxICMPEchoHeader ) )
1085+
{
1086+
break;
1087+
}
1088+
10841089
uxDataLength = uxDataLength - sizeof( *pxICMPEchoHeader );
10851090

10861091
/* Find the first byte of the data within the ICMP packet. */

0 commit comments

Comments
 (0)