]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
c/r: fix off-by-one error 1270/head
authorTycho Andersen <tycho.andersen@canonical.com>
Wed, 2 Nov 2016 15:59:00 +0000 (15:59 +0000)
committerTycho Andersen <tycho.andersen@canonical.com>
Wed, 2 Nov 2016 15:59:00 +0000 (15:59 +0000)
When we read sizeof(buf) bytes here, we'd write off the end of the array,
which is bad :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
src/lxc/criu.c

index 3588b00928d06b15367bbd0905746bb34ac918e1..5456cc1e643afa50a16ef11f91d182c99cb78a98 100644 (file)
@@ -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);