mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-01 05:52:32 +07:00
Fix CoAP packet size calculation
PUBLISHED_FROM=43532ec3951779d17438b457fe6de6dea8f514fd
This commit is contained in:
+2
-1
@@ -9694,7 +9694,7 @@ static uint32_t coap_calculate_packet_size(struct mg_coap_message *cm,
|
||||
prev_opt_number = 0;
|
||||
while (opt != NULL) {
|
||||
*len += 1; /* basic delta/length */
|
||||
*len += coap_get_ext_opt_size(opt->number);
|
||||
*len += coap_get_ext_opt_size(opt->number - prev_opt_number);
|
||||
*len += coap_get_ext_opt_size((uint32_t) opt->value.len);
|
||||
/*
|
||||
* Current implementation performs check if
|
||||
@@ -9708,6 +9708,7 @@ static uint32_t coap_calculate_packet_size(struct mg_coap_message *cm,
|
||||
return MG_COAP_ERROR | MG_COAP_OPTIOMG_FIELD;
|
||||
}
|
||||
*len += opt->value.len;
|
||||
prev_opt_number = opt->number;
|
||||
opt = opt->next;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user