Skip to content
Snippets Groups Projects
Commit 4be56c19 authored by Greg Kurz's avatar Greg Kurz
Browse files

fsdev: fix virtfs-proxy-helper cwd


Since chroot() doesn't change the current directory, it is indeed a good
practice to chdir() to the target directory and then then chroot(), or
to chroot() to the target directory and then chdir("/").

The current code does neither of them actually. Let's go for the latter.

This doesn't fix any security issue since all of this takes place before
the helper begins to process requests.

Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent 6a87e792
No related branches found
No related tags found
No related merge requests found
......@@ -1129,14 +1129,14 @@ int main(int argc, char **argv)
}
}
if (chdir("/") < 0) {
do_perror("chdir");
goto error;
}
if (chroot(rpath) < 0) {
do_perror("chroot");
goto error;
}
if (chdir("/") < 0) {
do_perror("chdir");
goto error;
}
get_version = false;
#ifdef FS_IOC_GETVERSION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment