diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-17 12:00:12 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:50:10 +0200 |
commit | d24d415d801b89ff2804e82c62209436fc3a3a25 (patch) | |
tree | 1d5e4d9a5760f98c0d237a0f2c23897e15826d21 /src/basic/fs-util.c | |
parent | d569509362723ee91d86feb0f139f2e874cce9d9 (diff) |
fs-util: extra chase_symlink() safety check on "path" parameter
It's not clear what an empty "path" is even supposed to mean, hence
refuse.
Diffstat (limited to 'src/basic/fs-util.c')
-rw-r--r-- | src/basic/fs-util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 7a05e22ea..bbc464e31 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -652,6 +652,9 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, if ((flags & (CHASE_NONEXISTENT|CHASE_OPEN)) == (CHASE_NONEXISTENT|CHASE_OPEN)) return -EINVAL; + if (isempty(path)) + return -EINVAL; + /* This is a lot like canonicalize_file_name(), but takes an additional "root" parameter, that allows following * symlinks relative to a root directory, instead of the root of the host. * |