projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7099575
)
virtiofsd: prevent ".." escape in lo_do_lookup()
author
Stefan Hajnoczi
<stefanha@redhat.com>
Mon, 4 Mar 2019 10:38:46 +0000
(10:38 +0000)
committer
Dr. David Alan Gilbert
<dgilbert@redhat.com>
Thu, 23 Jan 2020 16:41:36 +0000
(16:41 +0000)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tools/virtiofsd/passthrough_ll.c
patch
|
blob
|
history
diff --git
a/tools/virtiofsd/passthrough_ll.c
b/tools/virtiofsd/passthrough_ll.c
index e3754061601a0b8d9c83ceb32628398e0f133308..79d5966eea4954dc9fbd1a8b34f28e3e818a250f 100644
(file)
--- a/
tools/virtiofsd/passthrough_ll.c
+++ b/
tools/virtiofsd/passthrough_ll.c
@@
-624,12
+624,17
@@
static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
int res;
int saverr;
struct lo_data *lo = lo_data(req);
- struct lo_inode *inode;
+ struct lo_inode *inode
, *dir = lo_inode(req, parent)
;
memset(e, 0, sizeof(*e));
e->attr_timeout = lo->timeout;
e->entry_timeout = lo->timeout;
+ /* Do not allow escaping root directory */
+ if (dir == &lo->root && strcmp(name, "..") == 0) {
+ name = ".";
+ }
+
newfd = openat(lo_fd(req, parent), name, O_PATH | O_NOFOLLOW);
if (newfd == -1) {
goto out_err;