From cbb0a561e64b25001039f0ac82170536b2ef4893 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Thu, 14 Aug 2025 19:15:09 +0200 Subject: [PATCH] crypto/bio/bio_print.c: reset max to zero if empty precision string is provided MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Per [1]: a null digit string is treated as zero. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html Signed-off-by: Eugene Syromiatnikov Reviewed-by: Saša Nedvědický Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/28177) --- crypto/bio/bio_print.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/bio/bio_print.c b/crypto/bio/bio_print.c index f8031743ac1..3cb4d285574 100644 --- a/crypto/bio/bio_print.c +++ b/crypto/bio/bio_print.c @@ -182,8 +182,11 @@ _dopr(char **sbuffer, max = va_arg(args, int); ch = *format++; state = DP_S_MOD; - } else + } else { + if (max < 0) + max = 0; state = DP_S_MOD; + } break; case DP_S_MOD: switch (ch) { -- 2.47.3