Skip to content

Commit 085741c

Browse files
committed
FreeRTOS_FillEndPoint: save pxNext before clearing entire endpoint struct
1 parent 855d6d5 commit 085741c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source/FreeRTOS_Routing.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ struct xIPv6_Couple
109109
/* Fill in and add an end-point to a network interface.
110110
* The user must make sure that the object pointed to by 'pxEndPoint'
111111
* will remain to exist. */
112+
113+
/* As the endpoint might be part of a linked list,
114+
protect the field pxNext from being overwritten. */
115+
NetworkEndPoint_t * pxNext = pxEndPoint->pxNext;
112116
( void ) memset( pxEndPoint, 0, sizeof( *pxEndPoint ) );
117+
pxEndPoint->pxNext = pxNext;
113118

114119
ulIPAddress = FreeRTOS_inet_addr_quick( ucIPAddress[ 0 ], ucIPAddress[ 1 ], ucIPAddress[ 2 ], ucIPAddress[ 3 ] );
115120
pxEndPoint->ipv4_settings.ulNetMask = FreeRTOS_inet_addr_quick( ucNetMask[ 0 ], ucNetMask[ 1 ], ucNetMask[ 2 ], ucNetMask[ 3 ] );

0 commit comments

Comments
 (0)