Skip to content

Commit

Permalink
Merge pull request #17850 from fabian18/bugfix_nib_6LN_context_option…
Browse files Browse the repository at this point in the history
…_length

ipv6/nib: bugfix of 6CO length checking
  • Loading branch information
fabian18 authored Mar 24, 2022
2 parents f4385ae + 77cbe15 commit 09b98ea
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,10 @@ uint32_t _handle_6co(const icmpv6_hdr_t *icmpv6,
#ifdef MODULE_GNRC_SIXLOWPAN_CTX
uint8_t cid;
#endif /* MODULE_GNRC_SIXLOWPAN_CTX */

if ((sixco->len != SIXLOWPAN_ND_OPT_6CTX_LEN_MIN) ||
((sixco->len != SIXLOWPAN_ND_OPT_6CTX_LEN_MAX) &&
(sixco->ctx_len > 64U)) ||
(icmpv6->type != ICMPV6_RTR_ADV)) {
DEBUG("nib: received 6CO of invalid length (%u), must be %u "
"or wasn't delivered by RA."
"\n",
(void)icmpv6;
if (sixco->len != (sixco->ctx_len > 64U
? SIXLOWPAN_ND_OPT_6CTX_LEN_MAX : SIXLOWPAN_ND_OPT_6CTX_LEN_MIN)) {
DEBUG("nib: received 6CO of invalid length (%u), must be %u\n",
sixco->len,
(sixco->ctx_len > 64U) ? SIXLOWPAN_ND_OPT_6CTX_LEN_MAX :
SIXLOWPAN_ND_OPT_6CTX_LEN_MIN);
Expand Down

0 comments on commit 09b98ea

Please sign in to comment.