parse_timeout: move overflow check to the correct location

It was not covering all cases in its original location.
Fixes oss-fuzz issue 60454 with fuzz_sudoers.
This commit is contained in:
Todd C. Miller
2023-07-08 10:16:35 -06:00
parent fc02df111c
commit 9f7128fe83

View File

@@ -94,11 +94,11 @@ parse_timeout(const char *timestr)
l *= 60;
break;
}
if (l > INT_MAX - timeout)
goto overflow;
}
cp = ep;
if (l > INT_MAX - timeout)
goto overflow;
timeout += (int)l;
} while (*cp != '\0');