From 5a083c900c107259acde1dc94e96e3c530600c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Sat, 17 Jun 2023 11:49:02 +0200 Subject: [PATCH] utarfile: sanitize file size bytearray --- micropython/utarfile/utarfile/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/utarfile/utarfile/__init__.py b/micropython/utarfile/utarfile/__init__.py index 524207aa0..d5a02d9ef 100644 --- a/micropython/utarfile/utarfile/__init__.py +++ b/micropython/utarfile/utarfile/__init__.py @@ -116,7 +116,7 @@ def next(self): # Update the offset once we're sure it's not the run-out. self.offset += len(buf) d = TarInfo(str(h.name, "utf-8").rstrip("\0")) - d.size = int(bytes(h.size), 8) + d.size = int(bytes(h.size.replace(b"\x00", b"")), 8) self.subf = d.subf = FileSection(self.f, d.size, _roundup(d.size, _BLOCKSIZE)) self.offset += _roundup(d.size, _BLOCKSIZE) return d