diff options
-rw-r--r-- | src/firejail/main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index b3a8dcfd7..3690dee87 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -1506,9 +1506,14 @@ int main(int argc, char **argv) { | |||
1506 | return 1; | 1506 | return 1; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | // don't allow "--chroot=/" | ||
1510 | char *rpath = realpath(cfg.chrootdir, NULL); | 1509 | char *rpath = realpath(cfg.chrootdir, NULL); |
1511 | if (rpath == NULL || strcmp(rpath, "/") == 0) { | 1510 | if (rpath == NULL) { |
1511 | fprintf(stderr, "Error: invalid chroot directory\n"); | ||
1512 | exit(1); | ||
1513 | } | ||
1514 | // don't allow "--chroot=/" | ||
1515 | trim_trailing_slash_or_dot(rpath); | ||
1516 | if (strcmp(rpath, "/") == 0) { | ||
1512 | fprintf(stderr, "Error: invalid chroot directory\n"); | 1517 | fprintf(stderr, "Error: invalid chroot directory\n"); |
1513 | exit(1); | 1518 | exit(1); |
1514 | } | 1519 | } |