[CRIU] [PATCH 12/18] kerndat: prevent Out-of-bounds write
Andrei Vagin
avagin at openvz.org
Thu Nov 9 22:21:06 MSK 2017
From: Andrei Vagin <avagin at virtuozzo.com>
CID 181220 (#1 of 1): Out-of-bounds write (OVERRUN)
8. overrun-local: Overrunning array buf of 64 bytes at byte offset 64 using index ret (which evaluates to 64).
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
criu/kerndat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/criu/kerndat.c b/criu/kerndat.c
index 8c8976801..219bfd62c 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -197,7 +197,7 @@ int kerndat_files_stat(bool early)
buf[ret] = '\0';
max_files = atol(buf);
}
- ret = read(fd2, buf, sizeof(buf));
+ ret = read(fd2, buf, sizeof(buf) - 1);
if (ret > 0) {
buf[ret] = '\0';
nr_open = atol(buf);
--
2.13.6
More information about the CRIU
mailing list