diff --git a/src/lib/printf-format-fix.c b/src/lib/printf-format-fix.c index 69539875c3..001e7b02f7 100644 --- a/src/lib/printf-format-fix.c +++ b/src/lib/printf-format-fix.c @@ -38,11 +38,12 @@ static bool verify_length(const char **p) /* We don't bother supporting "*m$" - it's not used anywhere and seems a bit dangerous. */ *p += 1; - } else if (**p >= '1' && **p <= '9') { + } else if (**p >= '0' && **p <= '9') { /* Limit to 4 digits - we'll never want more than that. Some implementations might not handle long digits correctly, or maybe even could be used for DoS due - to using too much CPU. */ + to using too much CPU. If you want to express '99' + as '00099', then you lose in this function. */ unsigned int i = 0; do { *p += 1; diff --git a/src/lib/test-printf-format-fix.c b/src/lib/test-printf-format-fix.c index d369cf7f69..c9d6203de3 100644 --- a/src/lib/test-printf-format-fix.c +++ b/src/lib/test-printf-format-fix.c @@ -25,6 +25,7 @@ static void test_unchanged() "Precision %.9999s", "Precision %1.9999s", "Precision parameter %1.*s %.*s", + "Floating precisions such as %.0f %0.4f %-4.0f", "Length modifiers %hd %hhd %ld %lld %Lg %jd %zd %td", "Specifiers %s %u %d %c %i %x %X %p %o %e %E %f %F %g %G %a %A", "%%doesn't cause confusion in %%m and %%n",