From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-16 14:49:28 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!panix!news.panix.com!panix3.panix.com!not-for-mail From: comeau@panix.com (Greg Comeau) Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Subject: Re: How Ada could have prevented the Red Code distributed denial of service attack. Date: 16 Aug 2001 17:49:27 -0400 Organization: Comeau Computing; http://www.comeaucomputing.com Message-ID: <9lhf57$i8$1@panix3.panix.com> References: <3B7BC847.61D7EF55@home.com> Reply-To: comeau@comeaucomputing.com NNTP-Posting-Host: panix3.panix.com X-Trace: news.panix.com 997998567 8742 166.84.1.3 (16 Aug 2001 21:49:27 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: 16 Aug 2001 21:49:27 GMT Xref: archiver1.google.com comp.lang.ada:12017 comp.lang.c:74844 comp.lang.c++:83243 Date: 2001-08-16T21:49:27+00:00 List-Id: In article <3B7C1EF2.4DF3C7A5@gsde.hou.us.ray.com>, Samuel T. Harris wrote: >I do have my 1978 K&R handy and it is indeed ambiguous >as to whether or not the zero value automatically appended >after a string constant should or should not be counted >by size_of. I'm surprised! BTW, it's sizeof not size_of >The definition of size_of sizeof! :) >discusses the "size" of an object Ok. >while a string constant is defined as a sequence of chars >between quotes. Ok. >A zero value which is appended after or >at the end the string by the compiler. Ok. So, taking the above 3 ok's together, something such as "ab" contains 3 characters, 'a', 'b', and '\0'. And size the size of this object is 3. >Is is unclear as >to whether or not the zero value is considered part of the >string constant. Why is it unclear? You just said above that it's appended. How is that ambiguous? >There is a discussion of the difference between 'x' and "x" >which stipulates that "x" uses storage for 'x' and a zero value. That sounds right, and does not change the above. >Note that this reference is _not_ part of the C Reference Manual >section. What does it say in the C ref Manual then? >This seems to indicate that the zero value is part of the >storage of the string constant Agreed. >but size_of sizeof! >is not defined in terms of storage, but in terms of the size of an object. And what do they say that maks this difference of phrasing ambiguous as to what sizeof a string literal meant to K&R. >So, according to 1978 K&R, the value of size_of "ab" is >indeed open to interpretation. It's not obvious to me how it's open to interpretation. -- Greg Comeau Countdown to "export": December 1, 2001 Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries. Have you tried it?