]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: don't deref after NULL check
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 28 Oct 2020 03:01:19 +0000 (04:01 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 28 Oct 2020 03:01:19 +0000 (04:01 +0100)
Fixes: Coverity 1465855
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/utils.c

index c02eef15269435bbacadf6fe17f7e909115b1f30..561f7685cc18c983dcba144410dd064ec615d815 100644 (file)
@@ -1113,7 +1113,7 @@ int safe_mount_beneath(const char *beneath, const char *src, const char *dst, co
        __do_close int beneath_fd = -EBADF;
        const char *path = beneath ? beneath : "/";
 
-       beneath_fd = openat(-1, beneath, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH);
+       beneath_fd = openat(-1, path, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH);
        if (beneath_fd < 0)
                return log_error_errno(-errno, errno, "Failed to open %s", path);