Buffer overwrite in libstdc++-v3 test 21_strings/c_strings.c

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Wed Sep 26 07:05:00 GMT 2001


> Date: Wed, 26 Sep 2001 09:17:35 -0400 (EDT)
> From: Brad Garcia <garsh@home.com>

> On 24-Sep-2001 Hans-Peter Nilsson wrote:
    (Some other guy wrote:)
> > > how do you fit 37 characters (i.e. strlen(ccarray1) + 1 for the null)
> > > into 30 char buffer (size of carray), without overflowing it ?
> > 
> > That's the question I'm asking.  But presumably some corner in
> > that pile of papers called a C++ standards document could
> > interpret to say that strcpy should "DWIM" here.
> 
> I found nothing in the C++ standard that could be interpretted in
> such a way.
> 
> Do you mind pointing out the confusing section?

If you couldn't tell, I didn't actually read through the
standard before writing that presumption.  I just jumped to
conclusions based on this being a test-case and the obviousness
of the code.  Anyway, it's over; the bug's been fixed (thanks
Phil!).  Nothing to see here, move along, move along...

brgds, H-P



More information about the Libstdc++ mailing list