From: Tycho Andersen Date: Wed, 2 Nov 2016 15:59:00 +0000 (+0000) Subject: c/r: fix off-by-one error X-Git-Tag: lxc-2.1.0~281^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1270%2Fhead;p=thirdparty%2Flxc.git 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 --- 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);