Commit Diff


commit - 345b67f25dce7f6a5c981475844df01418a75cbb
commit + 71cd355cb2711ad528715bbbb5b41be7c26ace2a
blob - a157b990e93fe1cb15f7ba00f0d218349adca5a2
blob + d8319e4be5f8185780729a14a4a706eb136762d2
--- gotd/parse.y
+++ gotd/parse.y
@@ -181,7 +181,7 @@ timeout		: NUMBER {
 			}
 
 			$$.tv_usec = 0;
-			$$.tv_sec = strtonum($1, 0, INT_MAX, &errstr);
+			$$.tv_sec = strtonum($1, 0, INT_MAX / mul, &errstr);
 			if (errstr) {
 				yyerror("number of %s is %s: %s", type,
 				    errstr, $1);
@@ -189,13 +189,6 @@ timeout		: NUMBER {
 				YYERROR;
 			}
 
-			if ($$.tv_sec > INT_MAX / mul) {
-				yyerror("number of %s is too too large: %s",
-				    type, $1);
-				free($1);
-				YYERROR;
-			}
-
 			$$.tv_sec *= mul;
 			free($1);
 		}