Skip to content

Commit 66e3409

Browse files
author
Cruz Monrreal
authored
Merge pull request #7082 from anttiylitokola/master
Update mbed-coap to version 4.4.4
2 parents cabcdcf + 7b1484f commit 66e3409

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## [v4.4.4](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.4)
4+
**Closed issues:**
5+
- IOTCLT-2638 [GitHub] hardfault during reconnection retry with Thread
6+
7+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.4.3...v4.4.4)
8+
39
## [v4.4.3](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.3)
410
**Closed issues:**
511
- IOTCLT-2506 [GitHub] Cannot set registration time if server does not use max age option

features/frameworks/mbed-coap/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mbed-coap",
3-
"version": "4.4.3",
3+
"version": "4.4.4",
44
"description": "COAP library",
55
"keywords": [
66
"coap",

features/frameworks/mbed-coap/source/sn_coap_protocol.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,6 @@ void sn_coap_protocol_clear_sent_blockwise_messages(struct coap_s *handle)
265265

266266
/* Loop all stored Blockwise messages in Linked list */
267267
ns_list_foreach_safe(coap_blockwise_msg_s, removed_blocwise_msg_ptr, &handle->linked_list_blockwise_sent_msgs) {
268-
if (removed_blocwise_msg_ptr->coap_msg_ptr) {
269-
handle->sn_coap_protocol_free(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr);
270-
removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr = 0;
271-
sn_coap_parser_release_allocated_coap_msg_mem(handle, removed_blocwise_msg_ptr->coap_msg_ptr);
272-
removed_blocwise_msg_ptr->coap_msg_ptr = 0;
273-
}
274268
sn_coap_protocol_linked_list_blockwise_msg_remove(handle, removed_blocwise_msg_ptr);
275269
}
276270
#endif
@@ -1472,27 +1466,28 @@ static void sn_coap_protocol_handle_blockwise_timout(struct coap_s *handle)
14721466
ns_list_foreach_safe(coap_blockwise_msg_s, removed_blocwise_msg_ptr, &handle->linked_list_blockwise_sent_msgs) {
14731467
if ((handle->system_time - removed_blocwise_msg_ptr->timestamp) > SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED) {
14741468

1469+
// Item must be removed from the list before calling the rx_callback function.
1470+
// Callback could actually clear the list and free the item and cause a use after free when callback returns.
1471+
ns_list_remove(&handle->linked_list_blockwise_sent_msgs, removed_blocwise_msg_ptr);
1472+
14751473
/* * * * This messages has timed out, remove it from Linked list * * * */
14761474
if( removed_blocwise_msg_ptr->coap_msg_ptr ){
1477-
14781475
if (handle->sn_coap_rx_callback) {
14791476
/* Notify the application about the time out */
14801477
removed_blocwise_msg_ptr->coap_msg_ptr->coap_status = COAP_STATUS_BUILDER_BLOCK_SENDING_FAILED;
14811478
removed_blocwise_msg_ptr->coap_msg_ptr->msg_id = removed_blocwise_msg_ptr->msg_id;
14821479
handle->sn_coap_rx_callback(removed_blocwise_msg_ptr->coap_msg_ptr, NULL, removed_blocwise_msg_ptr->param);
14831480
}
14841481

1485-
if(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr){
1486-
handle->sn_coap_protocol_free(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr);
1487-
removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr = 0;
1488-
}
1482+
handle->sn_coap_protocol_free(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr);
14891483
sn_coap_parser_release_allocated_coap_msg_mem(handle, removed_blocwise_msg_ptr->coap_msg_ptr);
1490-
removed_blocwise_msg_ptr->coap_msg_ptr = 0;
14911484
}
1492-
sn_coap_protocol_linked_list_blockwise_msg_remove(handle, removed_blocwise_msg_ptr);
1485+
1486+
handle->sn_coap_protocol_free(removed_blocwise_msg_ptr);
14931487
}
14941488
}
14951489

1490+
14961491
/* Loop all incoming Blockwise messages */
14971492
ns_list_foreach_safe(coap_blockwise_payload_s, removed_blocwise_payload_ptr, &handle->linked_list_blockwise_received_payloads) {
14981493
if ((handle->system_time - removed_blocwise_payload_ptr->timestamp) > SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED) {

0 commit comments

Comments
 (0)