summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2015-07-20 10:42:40 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-07-22 00:17:07 -0400
commit9bcfea2a892de55e71f530472bef9b403f034edb (patch)
treeeda7d0dd0667fb8badcb9e888627d867d1ba6246 /util
parent8815116d1d0d502f81abecf32bc077f745b835a0 (diff)
downloade2fsprogs-9bcfea2a892de55e71f530472bef9b403f034edb.tar.gz
util: avoid off-by-one on long symlinks
readlink does not nul terminate its result, therefore one extra byte has to be taken into account. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'util')
-rw-r--r--util/symlinks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/symlinks.c b/util/symlinks.c
index abb33f8b..3acebe7a 100644
--- a/util/symlinks.c
+++ b/util/symlinks.c
@@ -166,7 +166,7 @@ static void fix_symlink (char *path, dev_t my_dev)
struct stat stbuf, lstbuf;
int c, fix_abs = 0, fix_messy = 0, fix_long = 0;
- if ((c = readlink(path, lpath, sizeof(lpath))) == -1) {
+ if ((c = readlink(path, lpath, sizeof(lpath) - 1)) == -1) {
perror(path);
return;
}