]> git.ipfire.org Git - thirdparty/openssl.git/commit
crypto/bio/bio_print.c: improve handling of unreasonably large widths/precisions
authorEugene Syromiatnikov <esyr@openssl.org>
Wed, 10 Sep 2025 08:11:22 +0000 (10:11 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 11 Sep 2025 16:01:51 +0000 (18:01 +0200)
commit98e17292227661c8f261d83116b2953d639dcf1e
treed2dadb6c01750a9c294a025b10af3759aec484d9
parentcffbccf5eafbc351fc9a9f019810e1dfe04eeb17
crypto/bio/bio_print.c: improve handling of unreasonably large widths/precisions

As fmt*() routines try to loop all the way up to pad sizes calculated
based on the user-provided width and precision specification,
it is relatively simple to trigger billions of loop iterations
by providing appropriate width and precision specification, even
if printing is done in a statically-sized buffer.  Avoid those
by introducing a helper eob_ok() function, that allows short-circuiting
those loops.

Resolves: https://github.com/openssl/openssl/issues/28416
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