mirror of https://github.com/vitalif/e2fsprogs
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>test-maint
parent
8815116d1d
commit
9bcfea2a89
|
@ -166,7 +166,7 @@ static void fix_symlink (char *path, dev_t my_dev)
|
||||||
struct stat stbuf, lstbuf;
|
struct stat stbuf, lstbuf;
|
||||||
int c, fix_abs = 0, fix_messy = 0, fix_long = 0;
|
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);
|
perror(path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue