From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: <gcc@gcc.gnu.org>
Subject: Re: Buffer Overflow Attacks
Date: Sun, 14 Oct 2001 12:29:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.33.0110142022090.405-100000@kern.srcf.societies.cam.ac.uk> (raw)
In-Reply-To: <87y9meypy7.fsf@deneb.enyo.de>
On Sun, 14 Oct 2001, Florian Weimer wrote:
> The struct hack for character arrays results in strictly conforming
> programs because arithmetic on pointers to a character type is not
> restricted in any way, as long the enclosing object is not left. This
> is a consequence of 6.3.2.3(7).
6.3.2.3#7:
[#7] A pointer to an object or incomplete type may be
converted to a pointer to a different object or incomplete
type. If the resulting pointer is not correctly aligned57)
for the pointed-to type, the behavior is undefined.
Otherwise, when converted back again, the result shall
compare equal to the original pointer. When a pointer to an
object is converted to a pointer to a character type, the
result points to the lowest addressed byte of the object.
Successive increments of the result, up to the size of the
object, yield pointers to the remaining bytes of the object.
The problem is, what is "the object"? In the struct hack, it is quite
arguably an array of size 1 within the structure - not the larger area
within which the structure was allocated.
--
Joseph S. Myers
jsm28@cam.ac.uk
next prev parent reply other threads:[~2001-10-14 12:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-14 8:01 dewar
2001-10-14 10:25 ` Florian Weimer
2001-10-14 11:08 ` Joseph S. Myers
2001-10-14 12:14 ` Florian Weimer
2001-10-14 12:29 ` Joseph S. Myers [this message]
2001-10-18 15:02 ` Michael Eager
-- strict thread matches above, loose matches on Subject: below --
2001-10-31 16:39 mike stump
2001-10-18 17:00 mike stump
2001-10-31 10:01 ` Florian Weimer
2001-10-14 12:25 dewar
2001-10-14 5:32 Frank Pilhofer
2001-10-14 7:33 ` Carlo Wood
2001-10-14 10:50 ` Florian Weimer
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=Pine.LNX.4.33.0110142022090.405-100000@kern.srcf.societies.cam.ac.uk \
--to=jsm28@cam.ac.uk \
--cc=fw@deneb.enyo.de \
--cc=gcc@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).