mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 04:20:20 +00:00
mesh: fix buffer overrun on network pdu setup
This commit is contained in:
parent
8eed85101f
commit
7727b2d69e
@ -1129,11 +1129,12 @@ void mesh_network_setup_pdu(mesh_network_pdu_t * network_pdu, uint16_t netkey_in
|
||||
network_pdu->len += 2;
|
||||
big_endian_store_16(network_pdu->data, network_pdu->len, dest);
|
||||
network_pdu->len += 2;
|
||||
btstack_assert((network_pdu->len + transport_pdu_len) <= MESH_NETWORK_PAYLOAD_MAX);
|
||||
(void)memcpy(&network_pdu->data[network_pdu->len], transport_pdu_data,
|
||||
transport_pdu_len);
|
||||
network_pdu->len += transport_pdu_len;
|
||||
// zero rest of packet
|
||||
memset(&network_pdu->data[network_pdu->len], 0, MESH_NETWORK_PAYLOAD_MAX - transport_pdu_len);
|
||||
memset(&network_pdu->data[network_pdu->len], 0, MESH_NETWORK_PAYLOAD_MAX - network_pdu->len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user