From ca2d6274770983cbbe5cf087c5e74872c6941c6a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 28 Apr 2011 13:27:52 -0700 Subject: [PATCH] Improve comment. --- src/doprnt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doprnt.c b/src/doprnt.c index db0b66c3aa2..22950ec6fad 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -199,11 +199,11 @@ doprnt (char *buffer, register size_t bufsize, const char *format, while (fmt < format_end && '0' <= fmt[1] && fmt[1] <= '9') { - /* Avoid int overflow, because many sprintfs seriously - mess up with widths or precisions greater than - INT_MAX. Avoid size_t overflow, since our counters - use size_t. This test is slightly conservative, for - speed and simplicity. */ + /* Avoid size_t overflow. Avoid int overflow too, as + many sprintfs mishandle widths greater than INT_MAX. + This test is simple but slightly conservative: e.g., + (INT_MAX - INT_MAX % 10) is reported as an overflow + even when it's not. */ if (n >= min (INT_MAX, SIZE_MAX) / 10) error ("Format width or precision too large"); n = n * 10 + fmt[1] - '0'; -- 2.39.2