From: Lennart Poettering Date: Wed, 17 Jan 2018 11:00:12 +0000 (+0100) Subject: fs-util: extra chase_symlink() safety check on "path" parameter X-Git-Tag: v237~87^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a49424af6a430bb2e83e606ee94c2549e1df0e1c;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 15f9958c05d..f0df79d8ff9 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -637,6 +637,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. *