From be0bb65ffe08f8a9a699568dc3bf641f44da2de9 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:15 -1000 Subject: Widen the cache ttl before multiplying it A ttl in the tens of millions of minutes overflowed the int it was multiplied in. --- source/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/cache.c b/source/cache.c index af391db..a076823 100644 --- a/source/cache.c +++ b/source/cache.c @@ -189,7 +189,9 @@ static int is_expired(struct cache_slot *slot) { if (slot->ttl < 0) return 0; - return slot->st.st_mtime + slot->ttl * SECONDS_PER_MINUTE < time(NULL); + // Widened before the multiply, since a ttl in the tens of millions of + // minutes overflows an int. + return slot->st.st_mtime + (time_t)slot->ttl * SECONDS_PER_MINUTE < time(NULL); } /* -- cgit