Skip to content

Commit

Permalink
FreeRTOS_FillEndPoint: save pxNext before clearing entire endpoint st…
Browse files Browse the repository at this point in the history
…ruct
  • Loading branch information
htibosch committed Sep 13, 2023
1 parent 855d6d5 commit 085741c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/FreeRTOS_Routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ struct xIPv6_Couple
/* Fill in and add an end-point to a network interface.
* The user must make sure that the object pointed to by 'pxEndPoint'
* will remain to exist. */

/* As the endpoint might be part of a linked list,
protect the field pxNext from being overwritten. */
NetworkEndPoint_t * pxNext = pxEndPoint->pxNext;
( void ) memset( pxEndPoint, 0, sizeof( *pxEndPoint ) );
pxEndPoint->pxNext = pxNext;

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

0 comments on commit 085741c

Please sign in to comment.