Merge pull request #10869 from gschorcht/gnrc_icmpv6_echo_fix

gnrc_icmpv6_echo: avoid crashing when pktbuf full
This commit is contained in:
Martine Lenders 2019-01-25 18:33:07 +01:00 committed by GitHub
commit 2d54069f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,6 +93,12 @@ void gnrc_icmpv6_echo_req_handle(gnrc_netif_t *netif, ipv6_hdr_t *ipv6_hdr,
pkt = hdr; pkt = hdr;
hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); 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) { if (netif != NULL) {
((gnrc_netif_hdr_t *)hdr->data)->if_pid = netif->pid; ((gnrc_netif_hdr_t *)hdr->data)->if_pid = netif->pid;
} }