summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/torcert.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/torcert.c b/src/or/torcert.c
index 2629155477..ef7775eb9e 100644
--- a/src/or/torcert.c
+++ b/src/or/torcert.c
@@ -139,7 +139,11 @@ tor_cert_parse(const uint8_t *encoded, const size_t len)
cert->encoded_len = len;
memcpy(cert->signed_key.pubkey, parsed->certified_key, 32);
- cert->valid_until = parsed->exp_field * 3600;
+ const int64_t valid_until_64 = ((int64_t)parsed->exp_field) * 3600;
+ if (valid_until_64 > TIME_MAX)
+ cert->valid_until = TIME_MAX - 1;
+ else
+ cert->valid_until = (time_t) valid_until_64;
cert->cert_type = parsed->cert_type;
for (unsigned i = 0; i < ed25519_cert_getlen_ext(parsed); ++i) {