fs/procfs: Improve subdirectory recognition
This patch fixes https://github.com/apache/nuttx/issues/16237, where cd'ing to a non-directory prefix of a procfs entry would succeed. Signed-off-by: Pip Cet <pipcet@protonmail.com>
This commit is contained in:
parent
43b29a0547
commit
cfab00817a
1 changed files with 4 additions and 2 deletions
|
|
@ -740,7 +740,8 @@ static int procfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
|
|||
/* Test for a sub-string match (e.g. "ls /proc/fs") */
|
||||
|
||||
else if (strncmp(g_procfs_entries[x].pathpattern, relpath,
|
||||
len) == 0)
|
||||
len) == 0 &&
|
||||
g_procfs_entries[x].pathpattern[len] == '/')
|
||||
{
|
||||
FAR struct procfs_level1_s *level1;
|
||||
|
||||
|
|
@ -1166,7 +1167,8 @@ static int procfs_stat(FAR struct inode *mountpt, FAR const char *relpath,
|
|||
/* Test for an internal subdirectory stat */
|
||||
|
||||
else if (strncmp(g_procfs_entries[x].pathpattern, relpath,
|
||||
len) == 0)
|
||||
len) == 0 &&
|
||||
g_procfs_entries[x].pathpattern[len] == '/')
|
||||
{
|
||||
/* It's an internal subdirectory */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue