From 7e61d298b8b781b221c18d765949e304039f7913 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 12 Aug 2023 20:41:11 +0300 Subject: [PATCH] (pax_decode_header): fix the loop range. The high boundary 'u' of loop was modified in the loop as a result of decode_num(). Signed-off-by: Andrew Borodin --- src/vfs/tar/tar-sparse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vfs/tar/tar-sparse.c b/src/vfs/tar/tar-sparse.c index 2111a88b4..e2d3fde35 100644 --- a/src/vfs/tar/tar-sparse.c +++ b/src/vfs/tar/tar-sparse.c @@ -657,6 +657,7 @@ pax_decode_header (tar_super_t * archive, struct tar_sparse_file *file) char nbuf[UINTMAX_STRSIZE_BOUND]; union block *blk; char *p; + size_t sparse_map_len; size_t i; off_t start; @@ -681,7 +682,9 @@ pax_decode_header (tar_super_t * archive, struct tar_sparse_file *file) else g_array_set_size (file->stat_info->sparse_map, u); - for (i = 0; i < u; i++) + sparse_map_len = u; + + for (i = 0; i < sparse_map_len; i++) { struct sp_array sp;