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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-16 14:34:19 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!longmorn.cisco.com!karthikg From: Karthik Gurusamy 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: Thu, 16 Aug 2001 14:34:12 -0700 Organization: Cisco Systems Inc. Message-ID: In-Reply-To: <87vgjnvh9v.fsf@pfaffben.user.msu.edu> References: <3b690498.1111845720@news.worldonline.nl> <9kbu15$9bj@augusta.math.psu.edu> <9kbvsr$a02@augusta.math.psu.edu> <3B69DB35.4412459E@home.com> <3B6F312F.DA4E178E@home.com> <23lok9.ioi.ln@10.0.0.2> <3B70AB15.35845A98@home.com> <3B721FF5.B7D854F6@home.com> <3B7BC847.61D7EF55@home.com> <3B7BCEC4.202A3FA@cfmu.eurocontrol.int> <3B7C0397.3AD029C6@home.com> <3B7C0F90.EC31384B@sensor.com> <3B7C3016.9D6085A@home.com> <87vgjnvh9v.fsf@pfaffben.user.msu.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cache-Post-Path: sj-nntpcache-5!unknown@longmorn.cisco.com X-Cache: nntpcache 2.4.0b2 (see http://www.nntpcache.org/) X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:12014 comp.lang.c:74835 comp.lang.c++:83235 Date: 2001-08-16T14:34:12-07:00 List-Id: On 16 Aug 2001, Ben Pfaff wrote: > "Warren W. Gay VE3WWG" writes: > > > Ron Natalie wrote: > > > > Re: sizeof "ab" returning 3 : > > > > > > > > I have personally run into this problem over the last decade or so > > > > (but likely >= 1990 in this case). > > > > > > > > I don't have access to the other platforms where I used to program C, > > > > but it may have been one of the following: SCO UNIX, Dec Alpha, or a > > > > Solaris platform. > > > > > > By definition sizeof "ab" must be three. Normal string literals > > > ("ab") must an array of three chars 'a', 'b', and '\0'. Sizeof > > > is always in terms of chars. > > > > I have seen implementations return the "rounded" size for this. That > > was my only point, and the rest is nothing new. I did not refer to > > wide characters and such. > > You have never seen an ANSI/ISO C implementation with a "rounded" > size for this, because this would be a violation of the C > standards and thus it would not be a C implementation at all. > Maybe you've seen something "C-like" that does that, but it > wasn't C. If I have char title[] = "hello world!"; Is sizeof title guaranteed to be 13 (strlen("hello world!) + 1)? Can it ever happen sizeof title is more than 13? Thanks, Karthik > -- > "When I have to rely on inadequacy, I prefer it to be my own." > --Richard Heathfield >