From: 2xsec Date: Thu, 14 Jun 2018 15:19:22 +0000 (+0900) Subject: coverity: #1425778 X-Git-Tag: lxc-3.1.0~248^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2403%2Fhead;p=thirdparty%2Flxc.git coverity: #1425778 Out-of-bounds write Signed-off-by: 2xsec --- diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 1ff4caef8..eab650d7e 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -1314,7 +1314,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)) {