From: "Luiz Fernando N. Capitulino" Subject: Re: array size 1 ? All headers Date: Wed, 21 Jul 2004 09:10:02 -0300 Sender: linux-c-programming-owner@vger.kernel.org Message-ID: <20040721091002.5efb175a.lcapitulino@terra.com.br> References: <20040721015338.M80608@sni.ph> <20040720235713.4cb83b20.lcapitulino@terra.com.br> <40FDE037.6080309@sancharnet.in> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <40FDE037.6080309@sancharnet.in> List-Id: Content-Type: text/plain; charset="us-ascii" To: gracecott@sancharnet.in Cc: linux-c-programming@vger.kernel.org Em Wed, 21 Jul 2004 08:47:11 +0530 joy screveu: | Luiz Fernando N. Capitulino wrote: | | > The program: | > | > char tst[1]; | > tst[0]='g'; | > tst[1]='r'; | > | > printf("%c %c\n", tst[0], tst[1]); | > | > compiles and works here! but to be honest, I don't why. I can prove it is | >an odd case, becase this also works (here): | > | > | > | correct me if I'm wrong, but I feel that the code you have written is | the classic case of a buffer overflow. Yes, you right. I did it to show to Greg if the program with buf[1], even indexed with buf[1] works, it is wrong. -- Luiz Fernando