]> git.eshelyaron.com Git - emacs.git/commitdiff
(doprnt): Fix overflow check.
authorAndreas Schwab <schwab@linux-m68k.org>
Wed, 21 Oct 2009 21:28:59 +0000 (21:28 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Wed, 21 Oct 2009 21:28:59 +0000 (21:28 +0000)
src/ChangeLog
src/doprnt.c

index 0e4d2d24b0cfc271b3c4ab7df42d210f5bb01363..8b309a7ebbfd0c6958a5ede54298e3fc0009b6fc 100644 (file)
@@ -1,3 +1,7 @@
+2009-10-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * doprnt.c (doprnt): Fix overflow check.
+
 2009-10-21  Jan Djärv  <jan.h.d@swipnet.se>
 
        * xterm.c (x_term_init): Remove XSynchronize call done for debugging.
index 2d5b893dd200ff45aef9d35ce7c960a5604fea44..7b089a941f8f5102c20b43c52c7f4eb9f779fcef 100644 (file)
@@ -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;
                    }