mirror of https://github.com/openssl/openssl.git
crypto/bio/bio_print.c: handle negative width argument
Per [1]: A negative field width is taken as a '-' flag followed by a positive field width. So, printf("%-*d", -12, 34) should lead to a 123-wide left-aligned output, "34 ". [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:
parent
96e021dfff
commit
7eb18e768d
|
@ -155,6 +155,10 @@ _dopr(char **sbuffer,
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
} else if (ch == '*') {
|
} else if (ch == '*') {
|
||||||
min = va_arg(args, int);
|
min = va_arg(args, int);
|
||||||
|
if (min < 0) {
|
||||||
|
flags |= DP_F_MINUS;
|
||||||
|
min = -min;
|
||||||
|
}
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
state = DP_S_DOT;
|
state = DP_S_DOT;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue