From d748c7114d2f06378ad0c76b6c981521dbcee92d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 15 Jun 2023 16:22:49 +0200 Subject: Fix null pointer dereference in tar sqfs_istream_t implementation When dropping the parent iterator, update the state _first_. Signed-off-by: David Oberhollenzer --- lib/tar/src/iterator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c index ed35b73..506148f 100644 --- a/lib/tar/src/iterator.c +++ b/lib/tar/src/iterator.c @@ -79,11 +79,11 @@ static bool is_sparse_region(const tar_iterator_t *tar, sqfs_u64 *count) static void drop_parent(tar_istream_t *tar, int state) { if (tar->parent != NULL) { - tar->parent->locked = false; - tar->parent = sqfs_drop(tar->parent); - if (state != 0 && tar->parent->state == 0) tar->parent->state = state; + + tar->parent->locked = false; + tar->parent = sqfs_drop(tar->parent); } tar->state = state; -- cgit v1.2.3