mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-01 14:04:18 +08:00
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>
This commit is contained in:
parent
8815116d1d
commit
9bcfea2a89
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user