]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/: Saturate addition to avoid overflow
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 18 Dec 2023 19:45:44 +0000 (20:45 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 14 Feb 2024 03:08:26 +0000 (04:08 +0100)
commitdbdda2a48a77d03e3566a1b1694fb597d63b81b0
tree7575ea6de6f53f2e443ff2faab571507cbcec2b8
parent541d4dde23e8cfaee8291d5a9289aa9de7fb80d2
lib/: Saturate addition to avoid overflow

Very large values in /etc/shadow could lead to overflows.  Make sure
that these calculations are saturated at LONG_MAX.  Since entries are
based on days and not seconds since epoch, saturating won't hurt anyone.

Co-developed-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Co-developed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from: 674409e2265e ("lib/: Saturate addition to avoid overflow")
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Link: <https://github.com/shadow-maint/shadow/pull/876>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/age.c
lib/isexpired.c