This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 593f95227 nimble/mesh: Check buffer space before relaying proxy message
593f95227 is described below

commit 593f95227a4073efde840a9bb34614929dfa7ed1
Author: Szymon Janc <[email protected]>
AuthorDate: Thu May 14 09:01:13 2026 +0200

    nimble/mesh: Check buffer space before relaying proxy message
    
    Check if there is enough space left in message buffer before appending.
    This prevents passing broken messages to higher layer.
---
 nimble/host/mesh/src/proxy_msg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/nimble/host/mesh/src/proxy_msg.c b/nimble/host/mesh/src/proxy_msg.c
index ef03b7d7c..2aac5c815 100644
--- a/nimble/host/mesh/src/proxy_msg.c
+++ b/nimble/host/mesh/src/proxy_msg.c
@@ -73,6 +73,11 @@ int bt_mesh_proxy_msg_recv(struct bt_mesh_proxy_role *role,
 {
        const uint8_t *data = buf;
 
+       if (net_buf_simple_tailroom(role->buf) < len - 1) {
+               BT_WARN("Proxy role buffer overflow");
+               return -EINVAL;
+       }
+
        switch (PDU_SAR(data)) {
        case SAR_COMPLETE:
                if (role->buf->om_len) {

Reply via email to