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 <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)
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) {