about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--stdio-common/vfprintf.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d1929eed4b..a43e7c6d52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2008-03-29  Ulrich Drepper  <drepper@redhat.com>
 
+	* stdio-common/vfprintf.c (vfprintf): Correct overflow test.
+
 	[BZ #5939]
 	* sysdeps/posix/tempname.c (__gen_tempname): Correct flag selection.
 
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index d10a5c6a13..ca6343c37f 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1513,7 +1513,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       if (prec > width
 	  && prec + 32 > (int)(sizeof (work_buffer) / sizeof (work_buffer[0])))
 	{
-	  if (__builtin_expect (prec > ~((size_t) 0) - 31, 0))
+	  if (__builtin_expect (prec > ~((size_t) 0) / sizeof (CHAR_T) - 31,
+				0))
 	    {
 	      done = -1;
 	      goto all_done;