mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
libc/stream: Check lowout bounds before access
Check the provided length before reading the current lowoutstream byte. This avoids reading past zero-length or fully consumed buffers before the loop condition stops. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This commit is contained in:
parent
0b37b86d68
commit
bab2b4a5f2
1 changed files with 1 additions and 1 deletions
|
|
@ -86,7 +86,7 @@ static ssize_t lowoutstream_puts(FAR struct lib_outstream_s *self,
|
|||
size_t idx = 0;
|
||||
DEBUGASSERT(self);
|
||||
|
||||
while (str[idx] != 0 && idx < len)
|
||||
while (idx < len && str[idx] != 0)
|
||||
{
|
||||
lowoutstream_putc(self, str[idx]);
|
||||
idx++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue