summaryrefslogtreecommitdiff
path: root/src/doprnt.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2009-10-21 21:28:59 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2009-10-21 21:28:59 +0000
commit268989432a747731efdef5241d5a686968bfe923 (patch)
tree3ad2970c8a51de238fa0fbcbfaf694c06d5f65a9 /src/doprnt.c
parent528c56e2d1f1ca98b5195ab9a45c44a46a3ff32a (diff)
downloademacs-268989432a747731efdef5241d5a686968bfe923.tar.gz
(doprnt): Fix overflow check.
Diffstat (limited to 'src/doprnt.c')
-rw-r--r--src/doprnt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doprnt.c b/src/doprnt.c
index 2d5b893dd20..7b089a941f8 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -126,9 +126,9 @@ doprnt (buffer, bufsize, format, format_end, nargs, args)
unsigned n = *fmt - '0';
while ('0' <= fmt[1] && fmt[1] <= '9')
{
- if (n * 10 / 10 != n
- || (n = n * 10 + (fmt[1] - '0')) < n)
+ if (n * 10 + fmt[1] - '0' < n)
error ("Format width or precision too large");
+ n = n * 10 + fmt[1] - '0';
*string++ = *++fmt;
}