fuse_lib_ioctl(): don't call memcpy with NULL argument
authorNikolaus Rath <Nikolaus@rath.org>
Mon, 25 Sep 2017 09:34:07 +0000 (10:34 +0100)
committerNikolaus Rath <Nikolaus@rath.org>
Mon, 25 Sep 2017 09:34:07 +0000 (10:34 +0100)
This was detected by using clang's undefined behavior sanitizer, but
didn't seem to cause problems in practice.

lib/fuse.c

index 5cc4e42aefe1bf5344bce47e0eb462aef8181919..7b0b979520eca445d95e55847eb6269ffd3ad5ec 100644 (file)
@@ -4148,7 +4148,7 @@ static void fuse_lib_ioctl(fuse_req_t req, fuse_ino_t ino, int cmd, void *arg,
        }
 
        assert(!in_bufsz || !out_bufsz || in_bufsz == out_bufsz);
-       if (out_buf)
+       if (out_buf && in_bufsz)
                memcpy(out_buf, in_buf, in_bufsz);
 
        err = get_path_nullok(f, ino, &path);