Skip to content

SIGSEGV in fuse_nfs_readdir due to permission denied on NFS server #32

@crossmeta

Description

@crossmeta

I am trying to port this fuse-nfs to Crossmeta FUSE on Windows https://github.com/crossmeta/cxfuse and amazingly in less than a hour, I could have the program running.
While testing I encountered this problem with fuse_nfs_readdir() when it tried to read directory with no permission and it received NFS error 13. But in the code I do not see check for status and instead start filling the directory entries and accessed NULL nfsdir pointer.

diff --git a/fuse/fuse-nfs.c b/fuse/fuse-nfs.c
index 0bddb30..fa4ef90 100755
--- a/fuse/fuse-nfs.c
+++ b/fuse/fuse-nfs.c
@@ -303,6 +303,8 @@ fuse_nfs_readdir(const char *path, void *buf, fuse_fill_dir_
                return ret;
        }
        wait_for_nfs_reply(nfs, &cb_data);
+       if (cb_data.status)
+               return cb_data.status;
 
        nfsdir = cb_data.return_data;
        while ((nfsdirent = nfs_readdir(nfs, nfsdir)) != NULL) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions