From eaa38124028db56d7656cd312ba82d927848119c Mon Sep 17 00:00:00 2001 From: Krisztian Fekete <1246751+e3krisztian@users.noreply.github.com> Date: Thu, 28 Sep 2023 22:47:32 +0200 Subject: [PATCH] fix(handlers): tighten tar header pattern Numeric fields are stored as padded octal numbers, not decimals. --- unblob/handlers/archive/tar.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unblob/handlers/archive/tar.py b/unblob/handlers/archive/tar.py index 0d2cf3d827..137ac775ad 100644 --- a/unblob/handlers/archive/tar.py +++ b/unblob/handlers/archive/tar.py @@ -214,10 +214,10 @@ class TarUnixHandler(_TarHandler): r"" # (pattern would be too big) char name[100] + _padded_field(r"[0-7]", 8) # char mode[8] - + _padded_field(r"[0-9]", 8) # char uid[8] - + _padded_field(r"[0-9]", 8) # char gid[8] - + _padded_field(r"[0-9]", 12) # char size[12] - + _padded_field(r"[0-9]", 12) # char mtime[12] + + _padded_field(r"[0-7]", 8) # char uid[8] + + _padded_field(r"[0-7]", 8) # char gid[8] + + _padded_field(r"[0-7]", 12) # char size[12] + + _padded_field(r"[0-7]", 12) # char mtime[12] + _padded_field(r"[0-7]", 8) # char chksum[8] + r"[0-7\x00]" # char typeflag[1] - no extensions # Extending/dropping typeflag pattern would cover all tar formats,