Skip to content

Commit

Permalink
Merge pull request #20320 from MrKevinWeiss/backport/2024.01/pr/fix_t…
Browse files Browse the repository at this point in the history
…nt_loopback

gnrc_ipv6: fix double-free when pinging TNT loopback address [backport 2024.01]
  • Loading branch information
benpicco authored Feb 2, 2024
2 parents 5d16f7e + 63ae3b3 commit bba5968
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 bba5968

Please sign in to comment.