diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-11-07 15:06:46 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-11-07 15:06:46 +0100 |
commit | c219bd79099b10529c6561e5130b2ef1c3b86cb2 (patch) | |
tree | f50ab390e1f257f56ce330d072aa821fac30d1da | |
parent | 5c972c5e9d79781e42bbdd7f7ff05a9830d94b23 (diff) | |
download | lr-c219bd79099b10529c6561e5130b2ef1c3b86cb2.tar.gz lr-c219bd79099b10529c6561e5130b2ef1c3b86cb2.tar.xz lr-c219bd79099b10529c6561e5130b2ef1c3b86cb2.zip |
readlin: check if buffer is too small
-rw-r--r-- | lr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lr.c b/lr.c index 4d897b8..23dd6b6 100644 --- a/lr.c +++ b/lr.c @@ -897,8 +897,8 @@ static const char * readlin(const char *p, const char *alt) { static char b[PATH_MAX]; - int r = readlink(p, b, sizeof b - 1); - if (r < 0) + ssize_t r = readlink(p, b, sizeof b - 1); + if (r < 0 || (size_t)r >= sizeof b - 1) return alt; b[r] = 0; return b; |