From: Christian Brauner Date: Thu, 4 Feb 2021 21:48:18 +0000 (+0100) Subject: utils: check for snprintf() error X-Git-Tag: lxc-5.0.0~300^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f40f0617e5a6e8bcf32d8b2ff87b016b817ddb4;p=thirdparty%2Flxc.git utils: check for snprintf() error Signed-off-by: Christian Brauner --- 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);