diff options
author | smitsohu <smitsohu@gmail.com> | 2021-05-08 00:05:48 +0200 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2021-05-08 00:05:48 +0200 |
commit | 14b104aa026de9dc1e206bc8b821e516300feee5 (patch) | |
tree | 72b1a9b22b292a4323e6a31be169626c15689ad4 /src | |
parent | add support for arbitrary whitelist directories (diff) | |
download | firejail-14b104aa026de9dc1e206bc8b821e516300feee5.tar.gz firejail-14b104aa026de9dc1e206bc8b821e516300feee5.tar.zst firejail-14b104aa026de9dc1e206bc8b821e516300feee5.zip |
tweak
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/firejail/util.c b/src/firejail/util.c index d16354d9d..def635ea7 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -1140,7 +1140,7 @@ void disable_file_path(const char *path, const char *file) { | |||
1140 | // ignore dirfd if path is absolute | 1140 | // ignore dirfd if path is absolute |
1141 | // https://web.archive.org/web/20180419120236/https://blogs.gnome.org/jamesh/2018/04/19/secure-mounts | 1141 | // https://web.archive.org/web/20180419120236/https://blogs.gnome.org/jamesh/2018/04/19/secure-mounts |
1142 | int safer_openat(int dirfd, const char *path, int flags) { | 1142 | int safer_openat(int dirfd, const char *path, int flags) { |
1143 | assert(path); | 1143 | assert(path && path[0]); |
1144 | flags |= O_NOFOLLOW; | 1144 | flags |= O_NOFOLLOW; |
1145 | 1145 | ||
1146 | int fd = -1; | 1146 | int fd = -1; |
@@ -1161,7 +1161,7 @@ int safer_openat(int dirfd, const char *path, int flags) { | |||
1161 | if (!dup) | 1161 | if (!dup) |
1162 | errExit("strdup"); | 1162 | errExit("strdup"); |
1163 | char *tok = strtok(dup, "/"); | 1163 | char *tok = strtok(dup, "/"); |
1164 | if (!tok) { // nothing to do, path is either empty string or the root directory | 1164 | if (!tok) { // nothing to do, path is the root directory |
1165 | free(dup); | 1165 | free(dup); |
1166 | return openat(dirfd, path, flags); | 1166 | return openat(dirfd, path, flags); |
1167 | } | 1167 | } |