You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2023/01/30 13:27:10 UTC

[nuttx] branch master updated: libc/stream: fix syslogstream_addstring length error

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2466c07aa3 libc/stream: fix syslogstream_addstring length error
2466c07aa3 is described below

commit 2466c07aa3baf3fc96837b5c85685f068751ad8c
Author: yinshengkai <yi...@xiaomi.com>
AuthorDate: Mon Jan 30 17:05:29 2023 +0800

    libc/stream: fix syslogstream_addstring length error
    
    Signed-off-by: yinshengkai <yi...@xiaomi.com>
---
 libs/libc/stream/lib_syslogstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/libc/stream/lib_syslogstream.c b/libs/libc/stream/lib_syslogstream.c
index 528f539974..9566d7cbbc 100644
--- a/libs/libc/stream/lib_syslogstream.c
+++ b/libs/libc/stream/lib_syslogstream.c
@@ -112,7 +112,7 @@ static int syslogstream_addstring(FAR struct lib_syslogstream_s *stream,
   do
     {
       int remain = CONFIG_IOB_BUFSIZE - iob->io_len;
-      remain = remain > len ? len : remain;
+      remain = remain > len - ret ? len - ret : remain;
       memcpy(iob->io_data + iob->io_len, buff + ret, remain);
       iob->io_len += remain;
       ret += remain;