g2gps commented on code in PR #10358:
URL: https://github.com/apache/nuttx/pull/10358#discussion_r1303618443


##########
libs/libc/stdio/lib_libfread.c:
##########
@@ -121,12 +122,25 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE 
*stream)
             {
               /* Is there readable data in the buffer? */
 
-              while (remaining > 0 && stream->fs_bufpos < stream->fs_bufread)
+              gulp_size = stream->fs_bufread - stream->fs_bufpos;
+
+              /* Avoid empty buffers or read requests greater than the size
+               *  buffer remaining
+               */
+
+              if (gulp_size <= CONFIG_STDIO_BUFFER_SIZE || count < gulp_size)

Review Comment:
   Thanks, that's a good change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to