pipcet opened a new pull request, #16295:
URL: https://github.com/apache/nuttx/pull/16295

   This patch fixes https://github.com/apache/nuttx/issues/16237, where cd'ing 
to a non-directory prefix of a procfs entry would succeed.
   
   I've read the contributing guidelines, and I think I'm short a mandatory 
build log; the problem is that there other (minor) issues that prevent building 
nuttx for my board out of the box. Advice welcome here!
   
   I did run `checkpatch.sh`.
   
   ## Summary
   
   As described in #16237 , the current procfs implementation allows 
nonsensical chdir operations to succeed. For example, if `/proc/thermal` exists 
but `/proc/t` doesn't, `cd /proc/t` will succeed and indicate that there is a 
`ermal` subdirectory.
   
   This is confusing and may potentially cause other bugs.
   
   This minimal fix simply adds two extra conditions in places where we think 
we recognized a directory prefix, ensuring that we're actually at a directory 
boundary (a '/').
   
   ## Impact
   
   The intended impact is minimal: chdir will fail in cases where it should 
have failed before, and we can no longer reach the buggy state of believing 
we're in a nonexistent directory in `/proc`.
   
   ## Testing
   
   Testing this was a bit hard as the current nuttx tree did not build out of 
the box for me and required other changes. I'd appreciate guidance on how to 
test further if that's helpful!


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to