changeset 105698:a08904175e1a

(doprnt): Fix overflow check.
author Andreas Schwab <schwab@linux-m68k.org>
date Wed, 21 Oct 2009 21:28:59 +0000
parents 136cf2d23c90
children bbd67ae03f38
files src/ChangeLog src/doprnt.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Oct 21 20:03:57 2009 +0000
+++ b/src/ChangeLog	Wed Oct 21 21:28:59 2009 +0000
@@ -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.
--- a/src/doprnt.c	Wed Oct 21 20:03:57 2009 +0000
+++ b/src/doprnt.c	Wed Oct 21 21:28:59 2009 +0000
@@ -126,9 +126,9 @@
 		  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;
 		    }