From: Eugene Syromiatnikov Date: Thu, 14 Aug 2025 17:15:09 +0000 (+0200) Subject: crypto/bio/bio_print.c: reset max to zero if empty precision string is provided X-Git-Tag: openssl-3.6.0-alpha1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbb0a561e64b25001039f0ac82170536b2ef4893;p=thirdparty%2Fopenssl.git crypto/bio/bio_print.c: reset max to zero if empty precision string is provided 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) --- 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) {