Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
X-Apparently-From: <earnie?boyd@yahoo.com>
Message-ID: <3A92A43D.7361155D@yahoo.com>
Date: Tue, 20 Feb 2001 12:07:09 -0500
From: Earnie Boyd <earnie_boyd@yahoo.com>
Reply-To: Earnie Boyd <cygwin@cygwin.com>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Reuben Thomas <rrt1001@cam.ac.uk>
CC: cygwin@cygwin.com
Subject: Re: mingw > 20001111: fstat bug: buffer overflow?
References: <Pine.LNX.4.33.0102201240330.1238-100000@localhost.localdomain>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Reuben Thomas wrote:
> 
> In mingw versions later than 20001111, i.e. 20001225 and 20010130, fstat
> seems to overrun the stat buffer passed to it. This is illustrated by the
> following program, in which if a simple struct stat is passed to test, foo
> crashes when it tries to return (presumably the return address is
> overwritten). If a struct bar (with extra padding before and after the
> struct stat) is used instead, there is no error.
> 
> >From looking at /usr/include/mingw/stat.h, it seems that there are at least
> two different versions of struct stat in play, potentially with different
> types, but I don't claim to understand what's going on.
> 

Which gcc version are you using?  There are different versions of the
stat structure based on whether you are using CRTDLL or MSVCRT.  There
is a bug in the specs file for gcc-2.95.2-7 in that __MSVCRT__ should be
defined when -mno-cygwin is used.  The absence of this is what has
caused your problem.

Earnie

P.S.: Thanks for the test case.  I'll try it out later.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

