From 3ec37acbd1809f322fd8270f2f8964013bea53f7 Mon Sep 17 00:00:00 2001 From: Martine Lenders <mail@martine-lenders.eu> Date: Sat, 17 Nov 2018 12:15:59 +0100 Subject: [PATCH] gnrc_ipv6: fix _fill_ipv6_hdr() for pure IPv6 packets If a packet only contains IPv6 and IPv6 extension header snips (e.g. if the IPv6 packet has no payload or if an extension header was not pre-parsed) --- sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index b030e39959..52a2f06155 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -442,7 +442,7 @@ static int _fill_ipv6_hdr(gnrc_netif_t *netif, gnrc_pktsnip_t *ipv6) } prev->next = payload; prev = payload; - } while (_is_ipv6_hdr(payload)); + } while (_is_ipv6_hdr(payload) && (payload->next != NULL)); DEBUG("ipv6: calculate checksum for upper header.\n"); if ((res = gnrc_netreg_calc_csum(payload, ipv6)) < 0) { if (res != -ENOENT) { /* if there is no checksum we are okay */ -- GitLab