mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-24 02:35:41 +00:00
read_fd_link(): don't overrun buf
This is a classical off-by-one error. If sizeof(buf) is 512, the last element is buf[511] but not buf[512]. Reported by Coverity, CID 114624, 114622 etc. Signed-off-by: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
0570dd81d6
commit
377763e5b1
1 changed files with 1 additions and 1 deletions
2
util.c
2
util.c
|
|
@ -467,7 +467,7 @@ int read_fd_link(int lfd, char *buf, size_t size)
|
|||
pr_err("Buffer for read link of fd %d is too small\n", lfd);
|
||||
return -1;
|
||||
}
|
||||
buf[ret] = 0;
|
||||
buf[ret - 1] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue