From owner-freebsd-chat@FreeBSD.ORG Thu Jun 1 14:09:45 2006 Return-Path: X-Original-To: freebsd-chat@freebsd.org Delivered-To: freebsd-chat@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FBAC16A972 for ; Thu, 1 Jun 2006 14:09:45 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA2BB43D45 for ; Thu, 1 Jun 2006 14:09:44 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.pc (host5.bedc.ondsl.gr [62.103.39.229]) (authenticated bits=128) by igloo.linux.gr (8.13.6/8.13.6/Debian-1) with ESMTP id k51E9VVv018345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 1 Jun 2006 17:09:33 +0300 Received: from gothmog.pc (gothmog [127.0.0.1]) by gothmog.pc (8.13.6/8.13.6) with ESMTP id k51EBiOY006416; Thu, 1 Jun 2006 17:11:44 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.pc (8.13.6/8.13.6/Submit) id k51EBiJF006415; Thu, 1 Jun 2006 17:11:44 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Thu, 1 Jun 2006 17:11:44 +0300 From: Giorgos Keramidas To: Rico Message-ID: <20060601141144.GC6057@gothmog.pc> References: <447EA92E.8070500@io.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <447EA92E.8070500@io.dk> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.409, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.79, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-chat@freebsd.org Subject: Re: A joke X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2006 14:09:46 -0000 On 2006-06-01 10:45, Rico wrote: > Seasoned pro > ------------ I really don't think so! This seasoned ``pro'' has a buffer overflow in his class :P Not to mention the other C++ bug in there too... > #include > > const int MAXLEN = 80; > class outstring; > class outstring { > private: > int size; > char str[MAXLEN]; > public: > outstring() { size=0; } > ~outstring() {size=0;} > void print(); > void assign(char *chrs); > }; > > void outstring::print() { > int i; > for (i=0 ; i< size ; i++) > cout << str[i]; > cout << "\n"; > } > > void outstring::assign(char *chrs) { > int i; > for (i=0; chrs[i] != '\0';i++) > str[i] = chrs[i]; > size=i; > } > > main (int argc, char **argv) { > outstring string; > string.assign("Hello World!"); > string.print(); > } outstring.assign("This line is too long for the absurd limit " "of `MAXLINE' characters and will probably result in something " "weird happening; anything is possible in the land of " "undefined behavior, yay!\n"); :)