From 82c24a730645addda12b8200166aa9f67cf12b5e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 11 Feb 2021 10:30:38 +0100 Subject: [PATCH] file_utils: convert to strnprintf() Signed-off-by: Christian Brauner --- src/lxc/file_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/file_utils.c b/src/lxc/file_utils.c index e2a3837f9..e046c2dd0 100644 --- a/src/lxc/file_utils.c +++ b/src/lxc/file_utils.c @@ -617,8 +617,8 @@ int timens_offset_write(clockid_t clk_id, int64_t s_offset, int64_t ns_offset) if (fd < 0) return -errno; - len = snprintf(buf, sizeof(buf), "%d %" PRId64 " %" PRId64, clk_id, s_offset, ns_offset); - if (len < 0 || len >= sizeof(buf)) + len = strnprintf(buf, sizeof(buf), "%d %" PRId64 " %" PRId64, clk_id, s_offset, ns_offset); + if (len < 0) return ret_errno(EFBIG); ret = lxc_write_nointr(fd, buf, len); -- 2.47.2