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

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 024bec2f8941f6d365e23f432bc581d50c6f5079
Author: huojianchao <[email protected]>
AuthorDate: Tue Oct 13 20:11:18 2026 +0800

    drivers/note: stop note_add() walking off a malformed packet
    
    0184bd10ecd ported this change to sched_note_add() at a time when the
    notes on the rpmsg wire were not padded, so it compares nc_length with
    what is left of the packet.  Since "drivers/note: Fix data address
    alignment trap cause by sched_note_add." the walk steps by
    NOTE_ALIGN(notelen), and a last note that comes without its padding
    passes that test, then wraps len around.  Compare the padded length,
    as the original change does.
    
    Assisted-by: Kiro:claude-opus-5-5
    Signed-off-by: huojianchao <[email protected]>
---
 drivers/note/note_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c
index 007034ee13e..6263cd24fd8 100644
--- a/drivers/note/note_driver.c
+++ b/drivers/note/note_driver.c
@@ -611,7 +611,8 @@ void sched_note_add(FAR const void *data, size_t len)
        * claims more than is left would wrap len and walk off the packet.
        */
 
-      if (notelen < sizeof(struct note_common_s) || notelen > len)
+      if (notelen < sizeof(struct note_common_s) ||
+          NOTE_ALIGN(notelen) > len)
         {
           break;
         }

Reply via email to