diff --git a/src/mesh/mesh_network.c b/src/mesh/mesh_network.c index d5300170b..025107c69 100644 --- a/src/mesh/mesh_network.c +++ b/src/mesh/mesh_network.c @@ -988,8 +988,7 @@ void mesh_network_send_pdu(mesh_network_pdu_t * network_pdu){ printf("^^ into network_pdus_queued\n"); #endif - uint8_t net_mic_len = network_pdu->data[1] & 0x80 ? 8 : 4; - btstack_assert((network_pdu->len + net_mic_len) <= 29); + btstack_assert((network_pdu->len + (network_pdu->data[1] & 0x80 ? 8 : 4)) <= 29); btstack_assert(network_pdu->len >= 9); // setup callback diff --git a/src/mesh/mesh_upper_transport.c b/src/mesh/mesh_upper_transport.c index 7d7f6614f..10aa83e30 100644 --- a/src/mesh/mesh_upper_transport.c +++ b/src/mesh/mesh_upper_transport.c @@ -1008,9 +1008,9 @@ void mesh_upper_transport_init(){ void mesh_upper_transport_send_access_pdu(mesh_pdu_t *pdu){ if (pdu->pdu_type == MESH_PDU_TYPE_NETWORK){ - mesh_network_pdu_t * network_pdu = (mesh_network_pdu_t *) pdu; - btstack_assert(network_pdu->len >= 9); + btstack_assert(mesh_network_pdu_len((mesh_network_pdu_t *) pdu) >= 9); } + btstack_linked_list_add_tail(&upper_transport_outgoing, (btstack_linked_item_t*) pdu); mesh_upper_transport_run(); }