You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2019/07/24 08:22:36 UTC
[mynewt-nimble] 02/06: nimble/mesh: Fix null pointer access on
prov_init
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch 1_2_0_dev
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit d751f05139a05463e74f733159c1eacdd566b803
Author: MichaĆ Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jul 17 11:59:24 2019 +0200
nimble/mesh: Fix null pointer access on prov_init
During bt_mesh_prov_init() a bt_mesh_proxy_get_buf() function
is called that returns a buffer that tries to initialize
unallocated buffer. With this patch we just return NULL
here, and then the buffer is allocated after Proxy is initialized.
---
nimble/host/mesh/src/proxy.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/nimble/host/mesh/src/proxy.c b/nimble/host/mesh/src/proxy.c
index 1465940..609da54 100644
--- a/nimble/host/mesh/src/proxy.c
+++ b/nimble/host/mesh/src/proxy.c
@@ -681,7 +681,9 @@ struct os_mbuf *bt_mesh_proxy_get_buf(void)
{
struct os_mbuf *buf = clients[0].buf;
- net_buf_simple_init(buf, 0);
+ if (buf != NULL) {
+ net_buf_simple_init(buf, 0);
+ }
return buf;
}