From d0c6b86e82121c41cdaecd2f52fabae7b0c06071 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 11 Feb 2021 10:42:22 +0100 Subject: [PATCH] mount_utils: convert to strnprintf() Signed-off-by: Christian Brauner --- src/lxc/mount_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/mount_utils.c b/src/lxc/mount_utils.c index d47cbe655..5132ea226 100644 --- a/src/lxc/mount_utils.c +++ b/src/lxc/mount_utils.c @@ -138,8 +138,8 @@ static int __fs_prepare(const char *fs_name, int fd_from) * only use fds for mount. */ if (fd_from >= 0) { - ret = snprintf(source, sizeof(source), "/proc/self/fd/%d", fd_from); - if (ret < 0 || ret >= sizeof(source)) + ret = strnprintf(source, sizeof(source), "/proc/self/fd/%d", fd_from); + if (ret < 0) return log_error_errno(-EIO, EIO, "Failed to create /proc/self/fd/%d", fd_from); } -- 2.47.2