casaroli commented on code in PR #21473:
URL: https://github.com/apache/nuttx/pull/21473#discussion_r4490250631


##########
drivers/pipes/fifo.c:
##########
@@ -102,6 +104,13 @@ int nx_mkfifo(FAR const char *pathname, mode_t mode, 
size_t bufsize)
   FAR struct pipe_dev_s *dev;
   int ret;
 
+  /* Read the path before anything is held: a bad pointer faults here */
+
+  if (strnlen(pathname, PATH_MAX) == 0)

Review Comment:
   `strnlen()` is the one extra pass. It reads the whole user path before the 
lock is taken, so a bad pointer faults with no lock held; `pathname[0]` leaves 
the rest of the path to fault under the lock.



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