From 1ead3d79f7c749403794df87e65a8d0e78a6e599 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 7 May 2013 19:01:22 +0400 Subject: [PATCH] util: Check for overflow in read_fd_link Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util.c b/util.c index ee87cc815..e36ab7e75 100644 --- a/util.c +++ b/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;