Skip to content

Commit

Permalink
fixup! add assert when adding an option
Browse files Browse the repository at this point in the history
  • Loading branch information
kb2ma committed May 27, 2018
1 parent f36a556 commit 47d1f91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sys/net/application_layer/nanocoap/nanocoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ size_t coap_put_option_uri(uint8_t *buf, uint16_t lastonum, const char *uri, uin
static ssize_t _add_opt_pkt(coap_pkt_t *pkt, uint16_t optnum, uint8_t *val,
size_t val_len)
{
assert(pkt->options_len < NANOCOAP_NOPTS_MAX);

uint16_t lastonum = (pkt->options_len)
? pkt->options[pkt->options_len - 1].opt_num : 0;
assert(optnum >= lastonum);
Expand Down

0 comments on commit 47d1f91

Please sign in to comment.