This is an automated email from the ASF dual-hosted git repository. naraj pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit fa8ca30b87fce7af909d464cef9b9b3383626ea2 Author: Krzysztof Kopyściński <krzysztof.kopyscin...@codecoup.pl> AuthorDate: Mon Mar 29 13:04:55 2021 +0200 mesh: Check subnet existence in heartbeat_send Check that the assigned subnet hasn't been removed in heartbeat_send to avoid potential NULL defererence in transport's ctl_send. this is port of 8309353b7f556d7457f75b2777a2561a31a85a78 --- nimble/host/mesh/src/heartbeat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nimble/host/mesh/src/heartbeat.c b/nimble/host/mesh/src/heartbeat.c index f990dc0..3ba7ae3 100644 --- a/nimble/host/mesh/src/heartbeat.c +++ b/nimble/host/mesh/src/heartbeat.c @@ -87,8 +87,10 @@ static int heartbeat_send(const struct bt_mesh_send_cb *cb, void *cb_data) .xmit = bt_mesh_net_transmit_get(), }; - /* Do nothing if heartbeat publication is not enabled */ - if (pub.dst == BT_MESH_ADDR_UNASSIGNED) { + /* Do nothing if heartbeat publication is not enabled or the subnet is + * removed. + */ + if (!tx.sub || pub.dst == BT_MESH_ADDR_UNASSIGNED) { return 0U; }