dereference null (from nlug)
I thought that this challenge is quite interesting.
Although he already released a solution for his challenge,
I don't really like his solution and there is a shorter way
to do it (one-line). You can read through the thread to get
some hints. Let's see if anyone lugs people solve it. Those
who already know the solution, post to me instead (no spoliters).
----
Okay so here's this week's challenge:
dereference null, don't segfault, don't setup a signal handle for
SIGSEGV.... forinstance the following snippet of code will derefence
null.
--snip--snip--snip--
#include <stdio.h>
/* any othe libs you'd like that aren't signal.h */
int main (void) {
unsigned long int foo = 0;
printf("this is foo: %lu\n", foo);
/* ... some code here that's not a signal handler */
/* very explicitly dereference null */
foo = *((unsigned long int *)NULL);
printf ("this is foo after derefernce of null: %lu\n", foo);
(Continue reading)