diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-02-21 08:08:11 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-02-21 08:08:11 +0100 |
| commit | faa07fbcda7650c4df5f7e5680a78362e1d90fbf (patch) | |
| tree | d2d9eddac85e019fbc6cd8bf8b6efa615b57d09a /gui/src/main | |
| parent | 92aa85b77adcf4694d1b309296fcd1315ea8ebc3 (diff) | |
| download | mullvadvpn-faa07fbcda7650c4df5f7e5680a78362e1d90fbf.tar.xz mullvadvpn-faa07fbcda7650c4df5f7e5680a78362e1d90fbf.zip | |
Fix timeout duration not fitting into 32-bit signed integer
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/account.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gui/src/main/account.ts b/gui/src/main/account.ts index 0b992cee88..768126e566 100644 --- a/gui/src/main/account.ts +++ b/gui/src/main/account.ts @@ -225,8 +225,9 @@ export default class Account { const expiry = new Date(this.accountData.expiry).getTime(); const now = new Date().getTime(); const threeDays = 3 * 24 * 60 * 60 * 1000; - // Add 10 seconds to be on the safe side - const timeout = expiry - now - threeDays + 10_000; + // Add 10 seconds to be on the safe side. Never make it longer than a 24 days since + // the timeout needs to fit into a signed 32-bit integer. + const timeout = Math.min(expiry - now - threeDays + 10_000, 24 * 24 * 60 * 60 * 1000); this.firstExpiryNotificationScheduler.schedule(() => this.handleAccountExpiry(), timeout); } } |
