Per [1]:
If the '0' and '-' flags both appear, the '0' flag is ignored.
[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)
zpadlen = 0;
if (spadlen < 0)
spadlen = 0;
- if (flags & DP_F_ZERO) {
+ if (flags & DP_F_MINUS) {
+ spadlen = -spadlen;
+ } else if (flags & DP_F_ZERO) {
zpadlen = OSSL_MAX(zpadlen, spadlen);
spadlen = 0;
}
- if (flags & DP_F_MINUS)
- spadlen = -spadlen;
/* spaces */
while (spadlen > 0) {