Whamcloud - gitweb
e2fsck: fix use after free in calculate_tree()
authorWang Shilong <wshilong@ddn.com>
Tue, 31 Dec 2019 00:52:39 +0000 (19:52 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 9 Jan 2020 19:21:46 +0000 (14:21 -0500)
commitf3689a5d46e1edc9194358685a29340141af07a4
tree8434800d13172eacea9efdb00ab8a3ef641a4073
parent3c23017d9f7f336b472d5ed60427176c2a048591
e2fsck: fix use after free in calculate_tree()

The problem is alloc_blocks() will call get_next_block() which might
reallocate outdir->buf, and memory address could be changed after
this.  To fix this, pointers that point into outdir->buf, such as
int_limit and root need to be recaulated based on the new starting
address of outdir->buf.

[ Changed to correctly recalculate int_limit, and to optimize how we
  reallocate outdir->buf.  -TYT ]

Addresses-Debian-Bug: 948517
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 101e73e99ccafa0403fcb27dd7413033b587ca01)
e2fsck/rehash.c