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 7550fe3dd62e39d15f382b6e9562f91e23067133 Author: songjunfan <[email protected]> AuthorDate: Thu Jan 23 11:35:34 2025 +0800 drivers/note: keep the event note length within nc_length sched_note_event_ip() limited the note length to sizeof(data), which is 256 and does not fit in the uint8_t nc_length: an event of 256 bytes or more was recorded with nc_length 0, and the readers of the note stream cannot step over a note of length 0. Limit the length to sizeof(data) - 1. Signed-off-by: songjunfan <[email protected]> --- drivers/note/note_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c index aca3c0d22c0..1b39003c4db 100644 --- a/drivers/note/note_driver.c +++ b/drivers/note/note_driver.c @@ -1519,9 +1519,9 @@ void sched_note_event_ip(uint32_t tag, uintptr_t ip, uint8_t event, formatted = true; note = (FAR struct note_event_s *)data; length = SIZEOF_NOTE_EVENT(len); - if (length > sizeof(data)) + if (length >= sizeof(data)) { - length = sizeof(data); + length = sizeof(data) - 1; } note_common(tcb, ¬e->nev_cmn, length, event);
