public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roberto Sanchez <rcsanchez97@yahoo.es>
To: linux-kernel@vger.kernel.org
Subject: Re: Linux-2.4.22  memory overwriting
Date: Sun, 01 Feb 2004 07:33:48 -0500	[thread overview]
Message-ID: <401CF22C.2000905@yahoo.es> (raw)
In-Reply-To: <401CEDAD.70601@bluewin.ch>

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

Julien Rebetez wrote:
> Hi !
> I've writen the following program :
> 
> 
> #include <stdio.h>
> 
> int main ()
> {
>        int p[4];
>        p[0]=1;
>        p[1]=2;
>        p[2]=3;
>        p[3]=4;
>        p[4]=5;
> 
>        printf ("%i, %i, %i, %i, %i\n", p[0], p[1], p[2], p[3],
> p[4]);
>        return 0;
> }
> 
> I compile it with :
> 
> gcc -o test test.c -Wall
> 
> and when i launch it, the output is :
> 
> julien:$> ./test
> 1, 2, 3, 4, 5
> 
> Should I not get a SIGSEV from the system ? Isn't it dangerous to allow 
> the user to put 5 elements in a 4 elements tab?
> 
> (tested on Linux 2.4.22 on a i686)
> 
> Thanks

Remember that C was written by experts for use by experts.  C makes
the unfortunate assumption that you know *exactly* what you are doing.
This flexibility is great for tho advanced system programmer, but
dangerous for the unwary.

-Roberto

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

      parent reply	other threads:[~2004-02-01 12:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-01 12:14 Linux-2.4.22 memory overwriting Julien Rebetez
2004-02-01 12:21 ` Hugo Mills
2004-02-01 12:33 ` Roberto Sanchez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=401CF22C.2000905@yahoo.es \
    --to=rcsanchez97@yahoo.es \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox