From 00a3088cc1918fab2160e5f4510d2166174a2b11 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 10 May 2018 20:25:08 +0200 Subject: [PATCH] utils: account for terminating \0 byte Signed-off-by: Christian Brauner --- src/lxc/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 757579f9b..aa1676a01 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -2384,7 +2384,7 @@ int parse_byte_size_string(const char *s, int64_t *converted) if (!s || !strcmp(s, "")) return -EINVAL; - end = stpncpy(dup, s, sizeof(dup)); + end = stpncpy(dup, s, sizeof(dup) - 1); if (*end != '\0') return -EINVAL; -- 2.47.2