Not all the fields of struct stat are actually filled by us. This caused
rubbish to appear in the microseconds fields, which were then used as
base when changing atime/ctime (with e.g. touch), triggering EINVAL by
futimens/utimensat when those rubbish values were out of the range
allowed for microseconds.
---
 src/fuse.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/fuse.c b/src/fuse.c
index 288c02a..dd4f139 100644
--- a/src/fuse.c
+++ b/src/fuse.c
@@ -175,6 +175,7 @@ mount_local_readdir (const char *path, void *buf, 
fuse_fill_dir_t filler,
         if (ss->val[i].ino >= 0) {
           struct stat statbuf;
 
+          memset (&statbuf, 0, sizeof statbuf);
           statbuf.st_dev = ss->val[i].dev;
           statbuf.st_ino = ss->val[i].ino;
           statbuf.st_mode = ss->val[i].mode;
@@ -255,6 +256,7 @@ mount_local_getattr (const char *path, struct stat *statbuf)
   if (r == NULL)
     RETURN_ERRNO;
 
+  memset (statbuf, 0, sizeof *statbuf);
   statbuf->st_dev = r->dev;
   statbuf->st_ino = r->ino;
   statbuf->st_mode = r->mode;
-- 
1.8.3.1

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to