Merge pull request #181 from alexbakker/fix-152

Check for the possibility of an overflow when parsing OTP period
pull/183/head
Michael Schättgen 6 years ago committed by GitHub
commit e3b9b67fee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,7 +55,12 @@ public class TotpInfo extends OtpInfo {
} }
public static boolean isPeriodValid(int period) { public static boolean isPeriodValid(int period) {
return period > 0; if (period <= 0) {
return false;
}
// check for the possibility of an overflow when converting to milliseconds
return period <= Integer.MAX_VALUE / 1000;
} }
public void setPeriod(int period) throws OtpInfoException { public void setPeriod(int period) throws OtpInfoException {

Loading…
Cancel
Save