2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +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:
Cyrill Gorcunov 2013-05-07 19:01:22 +04:00 committed by Pavel Emelyanov
parent a94512dc13
commit 1ead3d79f7

3
util.c
View File

@ -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;