Commit 9c93e0d3 authored by Andrei Vagin's avatar Andrei Vagin Committed by Andrei Vagin

criu: fix two issue with possible out-of-bound access

Signed-off-by: 's avatarAndrei Vagin <avagin@openvz.org>
parent ecbec8be
...@@ -197,7 +197,7 @@ int kerndat_files_stat(bool early) ...@@ -197,7 +197,7 @@ int kerndat_files_stat(bool early)
buf[ret] = '\0'; buf[ret] = '\0';
max_files = atol(buf); max_files = atol(buf);
} }
ret = read(fd2, buf, sizeof(buf)); ret = read(fd2, buf, sizeof(buf) - 1);
if (ret > 0) { if (ret > 0) {
buf[ret] = '\0'; buf[ret] = '\0';
nr_open = atol(buf); nr_open = atol(buf);
......
...@@ -630,7 +630,7 @@ static int parasite_dump_cgroup(struct parasite_dump_cgroup_args *args) ...@@ -630,7 +630,7 @@ static int parasite_dump_cgroup(struct parasite_dump_cgroup_args *args)
return -1; return -1;
} }
if (len == sizeof(*args)) { if (len == sizeof(args->contents)) {
pr_warn("/proc/self/cgroup was bigger than the page size\n"); pr_warn("/proc/self/cgroup was bigger than the page size\n");
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment