about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-03-30 05:39:35 +0000
committerUlrich Drepper <drepper@redhat.com>2008-03-30 05:39:35 +0000
commit43f6bec195805539de8c3ef717fe3529809478df (patch)
tree0f034399765a3f6c25a63560b6acf831b58e0d2e
parente8a3212650421c7970bc776b4609987bd47a8cdf (diff)
downloadglibc-43f6bec195805539de8c3ef717fe3529809478df.tar.gz
glibc-43f6bec195805539de8c3ef717fe3529809478df.tar.xz
glibc-43f6bec195805539de8c3ef717fe3529809478df.zip
* stdio-common/vfprintf.c (vfprintf): Correct overflow test.
-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;