diff options
author | Jan Kara <jack@suse.cz> | 2020-03-30 11:09:31 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-04-10 00:10:53 -0400 |
commit | cceebf4ece9fe75fac685f49c090211be390f083 (patch) | |
tree | e476169aeb81589e1c2746ba79d1a4961edb58ef | |
parent | 93df80d2409d6e7d97701ab745b937f8903c808f (diff) | |
download | e2fsprogs-cceebf4ece9fe75fac685f49c090211be390f083.tar.gz |
ext2fs: fix error checking in dx_link()
dx_lookup() uses errcode_t return values. As such anything non-zero is
an error, not values less than zero. Fix the error checking to avoid
crashes on corrupted filesystems.
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/link.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c index 6f523aee7..7b5bb0221 100644 --- a/lib/ext2fs/link.c +++ b/lib/ext2fs/link.c @@ -571,7 +571,7 @@ static errcode_t dx_link(ext2_filsys fs, ext2_ino_t dir, dx_info.namelen = strlen(name); again: retval = dx_lookup(fs, dir, diri, &dx_info); - if (retval < 0) + if (retval) goto free_buf; retval = add_dirent_to_buf(fs, |