Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 1 Jan 2003 12:34:45 -0500
From: Christopher Faylor <cgf@redhat.com>
To: cygwin@cygwin.com
Cc: "Pierre A. Humblet" <pierre.humblet@ieee.org>
Subject: Re: Heads up: *possible* bug in cygwin
Message-ID: <20030101173445.GA1354@redhat.com>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com,
	"Pierre A. Humblet" <pierre.humblet@ieee.org>
References: <20030101100510.5b5b7f3f.steven.obrien2@ntlworld.com> <20030101170613.GA19419@redhat.com> <20030101171952.GA83996745@HPN5170X>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20030101171952.GA83996745@HPN5170X>
User-Agent: Mutt/1.5.1i

On Wed, Jan 01, 2003 at 12:19:52PM -0500, Pierre A. Humblet wrote:
>> On Wed, Jan 01, 2003 at 10:05:10AM +0000, Steven O'Brien wrote:
>
>> >In glib-1.2.10, gutils.c: g_get_any_init (void), the current user
>> >details are obtained from /etc/passwd. This code is called as part of
>> >glib initialisation, whether the app wants this data or not. It uses
>> >sysconf (_SC_GETPW_R_SIZE_MAX) to decide how much buffer to allocate for
>> >this data. But on cygwin this appears broken, and the call to getpwuid_r
>> >(getuid (), &pwd, buffer, bufsize, &pw) *may* overrun buffer, depending
>> >on the length of the line in /etc/passwd for the current user.
>
>Have you experienced an overrun? I see code in cygwin to set errno to 
>ERANGE if the buffer is too small.

Aha! There's the bug.  AFAICT, the size calculation is wrong.  It isn't
taking the size of all of the elements into consideration.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

