This is the mail archive of the libc-alpha@cygnus.com 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]

Re: libc/1084: a variable miss initialized in mbsrtowcs


>>>>> Shinya Hanataka writes:

>> Submitter-Id:  net
>> Originator:    Shinya Hanataka
>> Organization:  no
>> Confidential:  no
>> Synopsis:      a variable miss initialized in mbsrtowcs

>> Description:
 > 	In mbsrtowcs, with dst=NULL, data.outbufend is miss initialized,
 > 	because that data.outbuf is not initialized yet.
 > 	This cause endless loop in some environment.

Thanks.  Ulrich fixed this slightly different.  The patch will be in
glibc 2.1.1.

Andreas

1999-04-18  Ulrich Drepper  <drepper@cygnus.com>

	* wcsmbs/mbsrtowcs.c (__mbsrtowcs): Correctly initialize outbufend
	for dst==NULL.
	Fixes PR libc/1084.

Index: wcsmbs/mbsrtowcs.c
===================================================================
--- mbsrtowcs.c	1999/03/15 20:40:25	1.16
+++ mbsrtowcs.c	1999/04/18 17:10:19	1.17
@@ -1,6 +1,6 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -61,7 +61,7 @@
       const unsigned char *inbuf = (const unsigned char *) *src;
       const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
 
-      data.outbufend = data.outbuf + sizeof (buf);
+      data.outbufend = (char *) buf + sizeof (buf);
       do
 	{
 	  data.outbuf = (char *) buf;


-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de


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