From aa27ed71fa3e5d48dee1748dcf27b6323ec98a33 Mon Sep 17 00:00:00 2001 From: Felix <47172717+Diff-fusion@users.noreply.github.com> Date: Fri, 7 Oct 2022 11:59:04 +0200 Subject: [PATCH] gnrc_sixlowpan_frag_vrb: Assert no usage of a vrb with src_len == 0 --- .../network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c index 1ceacbdac6..e4a858f78d 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c @@ -53,6 +53,7 @@ gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_add( gnrc_sixlowpan_frag_vrb_t *vrbe = NULL; assert(base != NULL); + assert(base->src_len != 0); assert(out_netif != NULL); assert(out_dst != NULL); assert(out_dst_len > 0); @@ -168,6 +169,7 @@ gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_get( { DEBUG("6lo vrb: trying to get entry for (%s, %u)\n", gnrc_netif_addr_to_str(src, src_len, addr_str), src_tag); + assert(src_len != 0); for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { gnrc_sixlowpan_frag_vrb_t *vrbe = &_vrb[i]; @@ -189,6 +191,7 @@ gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_reverse( { DEBUG("6lo vrb: trying to get entry for reverse label switching (%s, %u)\n", gnrc_netif_addr_to_str(src, src_len, addr_str), tag); + assert(src_len != 0); for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { gnrc_sixlowpan_frag_vrb_t *vrbe = &_vrb[i];