From 00640329722fd86197ccd304451e1e32b1187caa Mon Sep 17 00:00:00 2001 From: ZUENS2020 <161032866+ZUENS2020@users.noreply.github.com> Date: Wed, 11 Mar 2026 21:34:58 +0800 Subject: [PATCH] Fix OOB read in contrib/untar.c parseoct() Reported-by: ZUENS2020 --- contrib/untar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/untar.c b/contrib/untar.c index 6d5e88e2..0d862b8a 100644 --- a/contrib/untar.c +++ b/contrib/untar.c @@ -60,11 +60,11 @@ parseoct(const char *p, size_t n) { unsigned long i = 0; - while ((*p < '0' || *p > '7') && n > 0) { + while (n > 0 && (*p < '0' || *p > '7')) { ++p; --n; } - while (*p >= '0' && *p <= '7' && n > 0) { + while (n > 0 && *p >= '0' && *p <= '7') { i *= 8; i += *p - '0'; ++p;