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;