Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c > #1650

Re: Second draft, "Safe arrays and pointers for C"

Path csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail
From Hans-Bernhard Bröker <HBBroeker@t-online.de>
Newsgroups comp.std.c
Subject Re: Second draft, "Safe arrays and pointers for C"
Date Sun, 02 Sep 2012 22:20:42 +0200
Lines 30
Message-ID <aahtcmFsb9U1@mid.dfncis.de> (permalink)
References <503FC37F.8050701@animats.com> <k1rd60$f4s$1@speranza.aioe.org> <50415632.6060606@animats.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.dfncis.de TQyrsOONM9GIksrQpPCVWQBRgd0LJ3tz0undF02FMb9hOueRMT+R28wyySBNRY1U2w9vLKbZer
Cancel-Lock sha1:8+4ONhk2CPuZh/UshBDiuVipw7I=
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20120604 Thunderbird/13.0
In-Reply-To <50415632.6060606@animats.com>
Xref csiph.com comp.std.c:1650

Show key headers only | View raw


On 01.09.2012 02:26, John Nagle wrote:

>     Not really.  The main use case for unions is for data read
> in from an external source, often a network.

No, it's not, because the vast majority of usages of unions for that 
purpose would automatically cause undefined behaviour.

>     Tightening down the screws further on that would alienate too many C
> programmers.  Consider the common idiom
>
> 	const char* msg[] =
> 	{"First message", "second message", "third message", 0 }

And that would run afoul of reading beyond the end of the array ... how?

> Or even
> 	int main(int argc, const char* argv[]);
>
> Most security attacks require write access.

Let's hold it right here for a moment.  So what is it you're trying to 
avoid: attacks or program crashes?  The distinction is quite important, 
because actual security attacks need write access a whole lot less than 
crashing programs would.  You can expose secret data by random reading, 
but it's a whole lot harder to crash a program that way.

>      C99 VLA parameters seem to be on the way out, anyway.

That hasn't become any less incorrect since the last time round.

Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-08-30 12:48 -0700
  Re: Second draft, "Safe arrays and pointers for C" pacman@kosh.dhis.org (Alan Curry) - 2012-08-31 22:17 +0000
    Re: Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-08-31 17:26 -0700
      Re: Second draft, "Safe arrays and pointers for C" Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-09-02 22:20 +0200
        Re: Second draft, "Safe arrays and pointers for C" BGB <cr88192@hotmail.com> - 2012-09-03 10:55 -0500
          Re: Second draft, "Safe arrays and pointers for C" Ike Naar <ike@iceland.freeshell.org> - 2012-09-03 16:39 +0000
            Re: Second draft, "Safe arrays and pointers for C" BGB <cr88192@hotmail.com> - 2012-09-03 13:18 -0500
  Re: Second draft, "Safe arrays and pointers for C" Jens Gustedt <jens.gustedt@loria.fr> - 2012-09-02 10:52 +0200
  Re: Second draft, "Safe arrays and pointers for C" Per <per.mathisen@gmail.com> - 2012-09-28 06:49 -0700
    Re: Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-09-28 11:36 -0700
      Re: Second draft, "Safe arrays and pointers for C" Per <per.mathisen@gmail.com> - 2012-10-01 09:38 -0700
        Re: Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-10-01 11:38 -0700
      Re: Second draft, "Safe arrays and pointers for C" Shao Miller <sha0.miller@gmail.com> - 2012-12-17 09:11 -0500
        Re: Second draft, "Safe arrays and pointers for C" Keith Thompson <kst-u@mib.org> - 2012-12-17 10:18 -0800
          Re: Second draft, "Safe arrays and pointers for C" Shao Miller <sha0.miller@gmail.com> - 2012-12-17 18:24 -0500
            Re: Second draft, "Safe arrays and pointers for C" Shao Miller <sha0.miller@gmail.com> - 2012-12-17 18:32 -0500
            Re: Second draft, "Safe arrays and pointers for C" Keith Thompson <kst-u@mib.org> - 2012-12-17 15:44 -0800

csiph-web