]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: acme: possible overflow in acme_will_expire()
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 25 Sep 2025 12:59:19 +0000 (14:59 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 25 Sep 2025 13:12:14 +0000 (15:12 +0200)
commitf256b5fdf3952f2f34764d2556e5bee72b742017
treecef2595433a7bd52ea8ebaeb72ded7ab3884fb31
parent68770479ea4dee323f5bb56e995282f7c2100d4f
BUG/MINOR: acme: possible overflow in acme_will_expire()

acme_will_expire() computes the schedule date using notAfter and
notBefore from the certificate. However notBefore could be greater than
notAfter and could result in an overflow.

This is unlikely to happen and would mean an incorrect certificate.

This patch fixes the issue by checking that notAfter > notBefore.

It also replace the int type by a time_t to avoid overflow on 64bits
architecture which is also unlikely to happen with certificates.

`(date.tv_sec + diff > notAfter)` was also replaced by `if (notAfter -
diff <= date.tv_sec)` to avoid an overflow.

Fix issue #3135.

Need to be backported to 3.2.
src/acme.c