Commit 1ead3d79 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

util: Check for overflow in read_fd_link

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a94512dc
...@@ -430,6 +430,9 @@ int read_fd_link(int lfd, char *buf, size_t size) ...@@ -430,6 +430,9 @@ int read_fd_link(int lfd, char *buf, size_t size)
if (ret < 0) { if (ret < 0) {
pr_perror("Can't read link of fd %d", lfd); pr_perror("Can't read link of fd %d", lfd);
return -1; 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; buf[ret] = 0;
......
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