Skip to content

Commit

Permalink
ipv6/nib: bugfix of 6CO length checking
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Mar 24, 2022
1 parent a2146ac commit 77cbe15
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 77cbe15

Please sign in to comment.