Messages in this thread | | | Date | Sun, 1 Feb 2004 12:21:34 +0000 | From | Hugo Mills <> | Subject | Re: Linux-2.4.22 memory overwriting |
| |
On Sun, Feb 01, 2004 at 01:14:37PM +0100, Julien Rebetez wrote: > Hi ! > I've writen the following program : [snip] > 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?
This is nothing to do the the kernel. It's to do with C.
Yes, it is dangerous to allow this behaviour. However, C doesn't perform bounds checking on arrays -- this is left to the programmer to ensure that an array is never accessed outside its bounds. The effects of accessing (reading or writing) an array outside its bounds are undefined. In this case, it's worked. In other situations, with different arrays, it may not work.
Nothing to see here. Move along.
Hugo.
-- === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 1C335860 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- Well, you don't get to be a kernel hacker simply by looking --- good in Speedos. -- Rusty Russell [unhandled content-type:application/pgp-signature] | |