crypto/bio/bio_print.c: correctly print 0X prefix for X conversion

Per [1]:

   For x or X conversion specifiers, a non-zero result shall have 0x (or 0X)
   prefixed to it.

[1] https://pubs.opengroup.org/onlinepubs/9799919799//functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)
This commit is contained in:
Eugene Syromiatnikov 2025-07-25 19:00:22 +02:00 committed by Neil Horman
parent 6f8beb7ce9
commit 96e021dfff
1 changed files with 1 additions and 1 deletions

View File

@ -473,7 +473,7 @@ fmtint(char **sbuffer,
if (base == 8)
prefix = "0";
if (base == 16)
prefix = "0x";
prefix = flags & DP_F_UP ? "0X" : "0x";
}
if (flags & DP_F_UP)
caps = 1;