This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.10-378-gcc88b37


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  cc88b371a5072242b76d80fae5483d1777029c71 (commit)
      from  67854c131c2ba8c013debf466b20cb13fffa120b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=cc88b371a5072242b76d80fae5483d1777029c71

commit cc88b371a5072242b76d80fae5483d1777029c71
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Thu Oct 29 16:03:07 2009 -0700

    Fix return value of puts for very long strings.

diff --git a/ChangeLog b/ChangeLog
index 48dfde7..15a753b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-10-29  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #10780]
+	* libio/ioputs.c (_IO_puts): Make sure to not return a number which
+	overflows the int return type.
+
 	[BZ #10717]
 	* malloc/memusagestat.c (main): Fix repairing of trace files.  We also
 	have to compute maxsize_total, we have to update the variables, and
diff --git a/libio/ioputs.c b/libio/ioputs.c
index 2f43e99..7fa5db5 100644
--- a/libio/ioputs.c
+++ b/libio/ioputs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1996,1997,1998,1999,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1996-1999,2003,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,6 +27,7 @@
 
 #include "libioP.h"
 #include <string.h>
+#include <limits.h>
 
 int
 _IO_puts (str)
@@ -40,7 +41,7 @@ _IO_puts (str)
        || _IO_fwide (_IO_stdout, -1) == -1)
       && _IO_sputn (_IO_stdout, str, len) == len
       && _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
-    result = len + 1;
+    result = MIN (INT_MAX, len + 1);
 
   _IO_release_lock (_IO_stdout);
   return result;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    4 ++++
 libio/ioputs.c |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]