]> 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:44 +0000 (20:22 +0200)
commit1a97cbcc21e0bd7b9ced40a03927e695ca0fe70b
tree27ade57f379a51d86cc9a5eacbf0a788fa1aab5a
parentc06e51cce3aeaa0e36622ab08f5e9a4320eea058
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