From bbac3af66e82f9f0fbfdbbdf1c0e7e3cbaea6be7 Mon Sep 17 00:00:00 2001 From: smitsohu Date: Thu, 30 Aug 2018 00:58:21 +0200 Subject: little tweak --- src/firejail/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/firejail/main.c b/src/firejail/main.c index 435c04d76..6170806f9 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -1500,15 +1500,14 @@ int main(int argc, char **argv) { cfg.chrootdir = tmp; } - // check chroot dirname exists - if (strstr(cfg.chrootdir, "..") || !is_dir(cfg.chrootdir) || is_link(cfg.chrootdir)) { + if (strstr(cfg.chrootdir, "..") || is_link(cfg.chrootdir)) { fprintf(stderr, "Error: invalid chroot directory %s\n", cfg.chrootdir); return 1; } - // don't allow "--chroot=/" + // check chroot dirname exists, don't allow "--chroot=/" char *rpath = realpath(cfg.chrootdir, NULL); - if (rpath == NULL || strcmp(rpath, "/") == 0) { + if (rpath == NULL || !is_dir(rpath) || strcmp(rpath, "/") == 0) { fprintf(stderr, "Error: invalid chroot directory\n"); exit(1); } -- cgit v1.2.3-70-g09d2