From 94f8ba00d624a6216d886839ee8a5cafb9f4475c Mon Sep 17 00:00:00 2001 From: ZoneMR Date: Wed, 3 Sep 2025 20:45:46 +0100 Subject: [PATCH] Modify parse_octal to allow space char termination, valid octal digits are only 0-7 not 0-9 --- src/microtar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/microtar.c b/src/microtar.c index e060637..7de35d2 100644 --- a/src/microtar.c +++ b/src/microtar.c @@ -51,8 +51,8 @@ static int parse_octal(const char* str, size_t len, unsigned* ret) { unsigned n = 0; - while(len-- > 0 && *str != 0) { - if(*str < '0' || *str > '9') + while(len-- > 0 && *str != 0 && *str != ' ') { + if(*str < '0' || *str > '7') return MTAR_EOVERFLOW; if(n > UINT_MAX/8)