fuse-nfs
fuse-nfs copied to clipboard
SIGSEGV in fuse_nfs_readdir due to permission denied on NFS server
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) {