[PATCH v1 7/7] erofs-utils: lib: tar: Initialize the variable to avoid using garbage value

Sandeep Dhavale dhavale at google.com
Thu Sep 14 08:11:04 AEST 2023


The value in variable 'e' is checked without initializing and can
wrongly signify end of tar 2 empty blocks.

Signed-off-by: Sandeep Dhavale <dhavale at google.com>
---
 lib/tar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tar.c b/lib/tar.c
index b58bfd5..c4c89ec 100644
--- a/lib/tar.c
+++ b/lib/tar.c
@@ -549,7 +549,7 @@ int tarerofs_parse_tar(struct erofs_inode *root, struct erofs_tarfile *tar)
 	char path[PATH_MAX];
 	struct erofs_pax_header eh = tar->global;
 	struct erofs_sb_info *sbi = root->sbi;
-	bool e, whout, opq;
+	bool whout, opq, e = false;
 	struct stat st;
 	erofs_off_t tar_offset, data_offset;
 
-- 
2.42.0.283.g2d96d420d3-goog



More information about the Linux-erofs mailing list