This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e93046d1b1fb3daa309e6c56781047631c74963c
Author: zhengyu16 <[email protected]>
AuthorDate: Wed Sep 24 13:21:09 2025 +0800

    fs/inode: return ENOENT if pathname is empty in inode_search
    
    An empty pathname does not name any inode.  Return -ENOENT early in
    inode_search() when the path is an empty string, instead of continuing
    into the search logic with a zero-length path.
    
    Signed-off-by: zhengyu16 <[email protected]>
---
 fs/inode/fs_inodesearch.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c
index 8badfe9a374..460a5554dbf 100644
--- a/fs/inode/fs_inodesearch.c
+++ b/fs/inode/fs_inodesearch.c
@@ -477,6 +477,11 @@ int inode_search(FAR struct inode_search_s *desc)
 
   DEBUGASSERT(desc != NULL && desc->path != NULL);
 
+  if (*desc->path == '\0')
+    {
+      return -ENOENT;
+    }
+
   /* Convert the relative path to the absolute path */
 
   if (*desc->path != '/')

Reply via email to