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;