]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
mtree: Fix hex parser 2982/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 26 Apr 2026 16:11:28 +0000 (18:11 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 9 May 2026 10:22:12 +0000 (12:22 +0200)
Digits a-f/A-F need an offset of 10.

Resolves #2975.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_format_mtree.c

index 4a5a49ca813635c7113a30595838a4487ebff473..97825bb635a64b40e7627f73999238f73b38a046 100644 (file)
@@ -2029,9 +2029,9 @@ parsedigit(char c)
        if (c >= '0' && c <= '9')
                return c - '0';
        else if (c >= 'a' && c <= 'f')
-               return c - 'a';
+               return 10 + c - 'a';
        else if (c >= 'A' && c <= 'F')
-               return c - 'A';
+               return 10 + c - 'A';
        else
                return -1;
 }