]> git.ipfire.org Git - thirdparty/openssl.git/commit
crypto/bio/bio_print.c: avoid signed int overow in padlen calculation in fmtstr
authorEugene Syromiatnikov <esyr@openssl.org>
Wed, 10 Sep 2025 08:03:11 +0000 (10:03 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 11 Sep 2025 16:01:51 +0000 (18:01 +0200)
commit7ff5df1014205bc0b45a12163b2e0b31492bf641
tree5220bc59e759f82ca98771d69a86c477fe4fbc67
parent56f67a6d618d2d738d5c15d5b2e1ca046431ddf1
crypto/bio/bio_print.c: avoid signed int overow in padlen calculation in fmtstr

In a highly unlikely situation of str being longer than INT_MAX,
a signed integer overflow in padlen calculation can be triggered.
Avoid it by reworking the check for the need of padlen calculation.

Fixes: 230c691a5218 "Fix fmtstr for BIO_printf() et al"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28502)
crypto/bio/bio_print.c