From 2735dfae4c38e20e6cf5c0f74c4e0f1b13890629 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 2 Nov 2016 15:59:00 +0000 Subject: [PATCH] c/r: fix off-by-one error When we read sizeof(buf) bytes here, we'd write off the end of the array, which is bad :) Signed-off-by: Tycho Andersen --- src/lxc/criu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 3588b0092..5456cc1e6 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -883,6 +883,8 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ goto out_fini_handler; } + if (n == sizeof(buf)) + n--; buf[n] = 0; ERROR("criu process exited %d, output:\n%s", WEXITSTATUS(status), buf); -- 2.47.2