From ac222521abd476acc21c3dd777853c883b91503d Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Wed, 25 Mar 2020 14:54:18 +0100 Subject: [PATCH] gnrc_sixlowpan_iphc: zero IPv6 header before decompressing into it --- .../gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c b/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c index 33521af52b..54cede6288 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c +++ b/sys/net/gnrc/network_layer/sixlowpan/iphc/gnrc_sixlowpan_iphc.c @@ -158,6 +158,9 @@ static size_t _iphc_ipv6_decode(const uint8_t *iphc_hdr, payload_offset++; } + /* bits of the uncompressed address might not be written in decompression, + * so zero the whole header first */ + memset(ipv6_hdr, 0, sizeof(*ipv6_hdr)); ipv6_hdr_set_version(ipv6_hdr); switch (iphc_hdr[IPHC1_IDX] & SIXLOWPAN_IPHC1_TF) {