aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 16:22:49 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 16:23:38 +0200
commitd748c7114d2f06378ad0c76b6c981521dbcee92d (patch)
treeea34846ca1e64b5c658f37c7ba7ea894857e2aea /lib
parent484cd01590ec488cca1f8a5c7c76cd223609e299 (diff)
Fix null pointer dereference in tar sqfs_istream_t implementation
When dropping the parent iterator, update the state _first_. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/tar/src/iterator.c6
1 files changed, 3 insertions, 3 deletions
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;