Commit d14beb1d authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

zdtm: don't write out of bounds

CID 174800 (#1 of 1): Out-of-bounds write (OVERRUN)
5. overrun-local: Overrunning array buf of 1024 bytes at byte offset 1024 using index n (which evaluates to 1024).
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 673f18d0
...@@ -93,7 +93,7 @@ bool checkval(char *path, char *val) ...@@ -93,7 +93,7 @@ bool checkval(char *path, char *val)
return false; return false;
} }
n = read(fd, buf, sizeof(buf)); n = read(fd, buf, sizeof(buf) - 1);
close(fd); close(fd);
if (n < 0) { if (n < 0) {
pr_perror("read"); pr_perror("read");
......
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