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