diff options
Diffstat (limited to 'main/snprintf.c')
-rw-r--r-- | main/snprintf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/snprintf.c b/main/snprintf.c index 0e052baa6a..a1b253cfda 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -677,10 +677,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / /* * Check if a precision was specified - * - * XXX: an unreasonable amount of precision may be specified - * resulting in overflow of num_buf. Currently we - * ignore this possibility. */ if (*fmt == '.') { adjust_precision = YES; @@ -694,6 +690,10 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / precision = 0; } else precision = 0; + + if (precision > FORMAT_CONV_MAX_PRECISION) { + precision = FORMAT_CONV_MAX_PRECISION; + } } else adjust_precision = NO; } else |