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


##########
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.
   
   yes, but the following code parses the same string again.
   
   > 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.
   
   the check isn't enough since the hack can spawn a thread and modify pathname 
in the background.



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