Commit Diff


commit - 0cef9478411f528bc7f37b8c7a21d21a7f650592
commit + 85bccbf76e77e3f3f535f42d21d106ad54504758
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);
 		}