From 7f40f0617e5a6e8bcf32d8b2ff87b016b817ddb4 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 4 Feb 2021 22:48:18 +0100 Subject: [PATCH] utils: check for snprintf() error Signed-off-by: Christian Brauner --- src/lxc/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 60d35ed92..f1ccf859c 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -1301,6 +1301,8 @@ int mount_from_at(int dfd_from, const char *path_from, ret = snprintf(dst_buf, sizeof(dst_buf), "/proc/self/fd/%d", fd_to); } + if (ret < 0 || ret >= sizeof(src_buf)) + return -EIO; if (is_empty_string(src_buf)) ret = mount(NULL, dst_buf, fstype, mnt_flags, data); -- 2.47.2