delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/01/18:56:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3E137F9D.6070208@ece.gatech.edu>
Date: Wed, 01 Jan 2003 18:54:05 -0500
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: "Pierre A. Humblet" <pierre DOT humblet AT ieee DOT org>
Subject: Re: Heads up: *possible* bug in cygwin
References: <20030101100510 DOT 5b5b7f3f DOT steven DOT obrien2 AT ntlworld DOT com> <20030101170613 DOT GA19419 AT redhat DOT com> <20030101171952 DOT GA83996745 AT HPN5170X> <20030101173445 DOT GA1354 AT redhat DOT com>

Christopher Faylor wrote:
> 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.

No comment on this stuff.  It's not the problem I am seeing.

The _SC_GETPW_R_SIZE_MAX thing was introduced after glib-1.2.8.  In 
1.2.8 the buffer size was just 64.  In later versions, glib tries the 
sysconf() call if available, otherwise uses some other set of defaults 
for various systems.

In any case, 64 is too small for cygwin -- but mebbe if there IS a bug 
in sysconf ( _SC_GETPW_R_SIZE_MAX ), then cgf's changes to cygwin will 
fix that.

But my bug is something else -- and it may be in newlib, but I suspect 
glib's g_printf_string_upper_bound function (and calling vsprintf 
instead of vsnprintf)

--Chuck


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019