diff --git a/lib/isc/print.c b/lib/isc/print.c index 75af14eff9..51b0c9b4fd 100644 --- a/lib/isc/print.c +++ b/lib/isc/print.c @@ -297,7 +297,9 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { length = strlen(buf); if (length < precision) zeropad = precision - length; - if (width) { + else if (length < width && zero) + zeropad = width - length; + if (width != 0) { pad = width - length - zeropad - strlen(head); if (pad < 0)