libc/stream: fix syslogstream_addstring length error

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-01-30 17:05:29 +08:00 committed by Alin Jerpelea
parent 17f410e647
commit 2466c07aa3

View File

@ -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;