Skip to content

Commit

Permalink
gnrc_ipv6: fix double free when pinging TNT loopback address
Browse files Browse the repository at this point in the history
  • Loading branch information
jia200x committed Jan 29, 2024
1 parent 8f111a3 commit 8dc5e91
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,13 @@ static void _send_multicast(gnrc_pktsnip_t *pkt, bool prep_hdr,
static void _send_to_self(gnrc_pktsnip_t *pkt, bool prep_hdr,
gnrc_netif_t *netif)
{
if (!_safe_fill_ipv6_hdr(netif, pkt, prep_hdr) ||
/* no netif header so we just merge the whole packet. */
(gnrc_pktbuf_merge(pkt) != 0)) {
/* _safe_fill_ipv6_hdr releases pkt on error */
if (!_safe_fill_ipv6_hdr(netif, pkt, prep_hdr)) {
DEBUG("ipv6: error looping packet to sender.\n");
return;
}
/* no netif header so we just merge the whole packet. */
else if (gnrc_pktbuf_merge(pkt) != 0) {
DEBUG("ipv6: error looping packet to sender.\n");
gnrc_pktbuf_release(pkt);
return;
Expand Down

0 comments on commit 8dc5e91

Please sign in to comment.