]> git.ipfire.org Git - thirdparty/openssl.git/commit
crypto/rand/randfile.c: avoid signed integer overflow in RAND_load_file
authorEugene Syromiatnikov <esyr@openssl.org>
Fri, 29 Aug 2025 08:02:39 +0000 (10:02 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 9 Sep 2025 18:22:30 +0000 (20:22 +0200)
commit5473955b3015d3ca49c040e5cf6ab9cd6bcdc1c8
tree78446faca6fa78fef8d0c182c3830f4c9a4ff312
parent2d54096c0a6495fbae73ab71b99383de8cc71e5c
crypto/rand/randfile.c: avoid signed integer overflow in RAND_load_file

If a file supplied to RAND_load_file is too big (more than INT_MAX bytes),
it is possible to trigger a signer integer overflow during ret calculation.
Avoid it by returning early when we are about to hit it on the next
iteration.

Reported-by: Liu-Ermeng <liuermeng2@huawei.com>
Resolves: https://github.com/openssl/openssl/issues/28375
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28379)

(cherry picked from commit 35db6a15d436aa4d981ebcd581eded55fc8c8fb6)
crypto/rand/randfile.c
doc/man3/RAND_load_file.pod