]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425778
author2xsec <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 15:19:22 +0000 (00:19 +0900)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 08:16:11 +0000 (09:16 +0100)
Out-of-bounds write

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/criu.c

index 97fbe57a85be11693edab7605b0913bb20cb5ae0..4359f7c4acd66fb621767d210404aa3e8c949627 100644 (file)
@@ -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)) {