mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-27 20:25:19 +00:00
util: Check for overflow in read_fd_link
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
a94512dc13
commit
1ead3d79f7
1 changed files with 3 additions and 0 deletions
3
util.c
3
util.c
|
|
@ -430,6 +430,9 @@ int read_fd_link(int lfd, char *buf, size_t size)
|
|||
if (ret < 0) {
|
||||
pr_perror("Can't read link of fd %d", lfd);
|
||||
return -1;
|
||||
} else if ((size_t)ret == size) {
|
||||
pr_err("Buffer for read link of fd %d is too small\n", lfd);
|
||||
return -1;
|
||||
}
|
||||
buf[ret] = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue