mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
wallet: don't try to set a timer past 2038 on 32-bit platforms.
It'll wrap, probably be in the past, and infinite loop. This was caused by an invoice with expiry set at 2076. This wrap caused us to think the expiry has already passed, and keep looping! Reported-by: @telelvis Fixes: #6339 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: lightnind: don't infinite loop on 32 bit platforms if only invoices are expiring after 2038.
This commit is contained in:
parent
910630c497
commit
336dcef541
1 changed files with 5 additions and 0 deletions
|
@ -225,6 +225,11 @@ static void install_expiration_timer(struct invoices *invoices)
|
|||
memset(&expiry, 0, sizeof(expiry));
|
||||
expiry.ts.tv_sec = invoices->min_expiry_time;
|
||||
|
||||
/* Hi! On a 32 bit time_t platform with an expiry after 2038? Let's
|
||||
* not set a timer, assuming you'll upgrade before then! */
|
||||
if (expiry.ts.tv_sec != invoices->min_expiry_time)
|
||||
goto done;
|
||||
|
||||
/* now > expiry */
|
||||
if (time_after(now, expiry))
|
||||
expiry = now;
|
||||
|
|
Loading…
Add table
Reference in a new issue