Fix OOB read in contrib/untar.c parseoct()

Reported-by: ZUENS2020
This commit is contained in:
ZUENS2020 committed 2026-03-11 21:36:49 +08:00
1 parent 78b632c336
commit 0064032972
1 file changed
+2 -2
+2 -2
View File
@@ -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;