From: Florian Weimer <fw@deneb.enyo.de>
To: mike stump <mrs@windriver.com>
Cc: eager@mvista.com, gcc@gcc.gnu.org, jsm28@cam.ac.uk
Subject: Re: Buffer Overflow Attacks
Date: Wed, 31 Oct 2001 10:01:00 -0000 [thread overview]
Message-ID: <87668vk6rp.fsf@deneb.enyo.de> (raw)
In-Reply-To: <200110182359.QAA00865@kankakee.wrs.com>
mike stump <mrs@windriver.com> writes:
> Well, I can't comment on the exact code you gave, but I can comment on
> C++ and code like this:
>
> struct foo {
> char c[31];
> int i;
int j;
(Otherwise the argument below is wrong, especially if sizeof(int)
equals sizeof(char).)
> } f;
>
> *(((char*)&f)+32) and *(((char*)&f)+33) are allowed.
Yes, that's right even for C. But this doesn't help in the case I
originally presented. While we certainly have (&(f.c[30])) equal to
(((char *)&f) + 30) (they both refer to the same object), it occured
to me that &(f.c[32]) is indeed undefined, but (((char *)&f) + 32) is
defined. It's a bit funny that if two objects which compare equal
show such different behavior, but I think that's way it's specified in
the standard.
So I have to retract my original claim that it was impossible to do
buffer overflow checks in such cases. After all, a pointer in C-speak
(or "address", as in "address-of operator") is not very similar to a
machine address.
next prev parent reply other threads:[~2001-10-31 10:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-18 17:00 mike stump
2001-10-31 10:01 ` Florian Weimer [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-10-31 16:39 mike stump
2001-10-14 12:25 dewar
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
2001-10-18 15:02 ` Michael Eager
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=87668vk6rp.fsf@deneb.enyo.de \
--to=fw@deneb.enyo.de \
--cc=eager@mvista.com \
--cc=gcc@gcc.gnu.org \
--cc=jsm28@cam.ac.uk \
--cc=mrs@windriver.com \
/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).