This is an automated email from the ASF dual-hosted git repository. pkarashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ca290e85eab4953f0188bd022bf829228c9af5e3 Author: yinshengkai <[email protected]> AuthorDate: Mon Mar 13 22:42:00 2023 +0800 libc: stream adds length check Signed-off-by: yinshengkai <[email protected]> --- libs/libc/stream/lib_syslogstream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/libc/stream/lib_syslogstream.c b/libs/libc/stream/lib_syslogstream.c index 9566d7cbbc..21eb8654f9 100644 --- a/libs/libc/stream/lib_syslogstream.c +++ b/libs/libc/stream/lib_syslogstream.c @@ -200,6 +200,11 @@ static int syslogstream_puts(FAR struct lib_outstream_s *this, int ret = 0; DEBUGASSERT(stream != NULL); + if (len <= 0) + { + return 0; + } + stream->last_ch = ((FAR const char *)buff)[len -1]; #ifdef CONFIG_SYSLOG_BUFFER
