diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 9fc81f1f0e7e..c5d395f4f181 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1902,8 +1902,10 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, err = copy_out_args(cs, &req->out, nbytes); if (req->in.h.opcode == FUSE_CANONICAL_PATH) { - req->out.h.error = kern_path((char *)req->out.args[0].value, 0, - req->canonical_path); + char *path = (char *)req->out.args[0].value; + + path[req->out.args[0].size - 1] = 0; + req->out.h.error = kern_path(path, 0, req->canonical_path); } fuse_copy_finish(cs);