Skip to content

Commit

Permalink
Merge pull request #10874 from gschorcht/gnrc_icmpv6_echo_fix
Browse files Browse the repository at this point in the history
gnrc_icmpv6_echo: avoid crashing when pktbuf full [backport 2019.01]
  • Loading branch information
aabadie authored Jan 26, 2019
2 parents b8565e4 + c88838f commit d2e1162
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sys/net/gnrc/network_layer/icmpv6/echo/gnrc_icmpv6_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ void gnrc_icmpv6_echo_req_handle(gnrc_netif_t *netif, ipv6_hdr_t *ipv6_hdr,
pkt = hdr;
hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);

if (hdr == NULL) {
DEBUG("icmpv6_echo: no space left in packet buffer\n");
gnrc_pktbuf_release(pkt);
return;
}

if (netif != NULL) {
((gnrc_netif_hdr_t *)hdr->data)->if_pid = netif->pid;
}
Expand Down

0 comments on commit d2e1162

Please sign in to comment.