From 5acd5cf0e9b64a50de04343041865f1c2e844481 Mon Sep 17 00:00:00 2001 From: 2xsec Date: Fri, 15 Jun 2018 00:19:22 +0900 Subject: [PATCH] coverity: #1425778 Out-of-bounds write Signed-off-by: 2xsec --- src/lxc/criu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 97fbe57a8..4359f7c4a 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -1209,7 +1209,11 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op SYSERROR("read"); n = 0; } - buf[n] = 0; + + if (n == sizeof(buf)) + buf[n-1] = 0; + else + buf[n] = 0; if (WIFEXITED(status)) { if (WEXITSTATUS(status)) { -- 2.47.2