public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rick Copeland <rick@proceler.com>
To: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
Cc: gcc@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: Buffer overwrite in libstdc++-v3 test 21_strings/c_strings.cc?
Date: Mon, 24 Sep 2001 06:44:00 -0000	[thread overview]
Message-ID: <3BAF38B2.4040806@proceler.com> (raw)
In-Reply-To: <200109241327.PAA00792@ignucius.axis.se>

Well, since strlen(ccarray1) == 36, and you're copying into a 30-byte 
array, it looks like an obvious buffer-overflow [write?].

Hans-Peter Nilsson wrote:

>Is this some C++ gotcha or is there an obvious buffer-overwrite
>here?  The CRIS gcc port and the simulator dump says the buffer
>is overwritten, but there's no absolute truth in that.
>
> ...
>  const char* ccarray1 = "san francisco roof garden inspectors";
>  const char* ccarray2 = "san francisco sunny-day park inspectors";
>  char carray[30];
>  std::strcpy(carray, ccarray1);
> ...
>
>Will trade patch for clue.
>
>brgds, H-P
>
>



  reply	other threads:[~2001-09-24  6:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-24  6:27 Hans-Peter Nilsson
2001-09-24  6:44 ` Rick Copeland [this message]
2001-09-24  7:20 ` Buffer overwrite in libstdc++-v3 test 21_strings/c_strings.c Greg Hosler
2001-09-24  7:37   ` Hans-Peter Nilsson
2001-09-24 13:18 Buffer overwrite in libstdc++-v3 test 21_strings/c_strings.cc? Benjamin Kosnik
2001-09-24 14:13 ` Phil Edwards
2001-09-24 14:30   ` Benjamin Kosnik
2001-09-25 18:46     ` Phil Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BAF38B2.4040806@proceler.com \
    --to=rick@proceler.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hans-peter.nilsson@axis.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).