From: wolff@liberator.et.tudelft.nl (Rogier Wolff) Subject: Process protection and Debugging. Date: 10 Mar 1993 15:17:25 GMT
Linux places the executable at address 0. This region
is therefore "read-execute". This should be
prevented:
#include <stdio.h>
main ()
{
char *tmp= NULL;
int i;
for (i=0;i<20;i++)
printf ("%d ",*tmp++);
printf ("\n");
}
======
This program should dump core. This makes it much easier to get
an indication on NULL pointer dereferences.
It actually dumps core on our SUN and DEC machines. It reports
a bunch of zeroes on our HP's and AIX machines. I think it is
best to trap to a segmentation violation to force people to
watch out for this "non-portability".
(If a system allows sloppy programming, people will write
sloppy programs. If you force them to look into a problem
they will fix the problem before they release the program
to the net: A good thing.)
Roger.
-- **** a 486 in V86 mode is like a VW buggy with a 6 litre V12 motor. **** EMail: wolff@duteca.et.tudelft.nl ** Tel +31-15-783643 or +31-15-142371