How Shellcodes Work
Subject:   Problem compiling c example.
Date:   2008-08-16 16:00:04
From:   lwante
Response to: Problem compiling c example.

What gryzlo said is wrong... the problem here is that you are trying to cast and lvalue(left value) which is illegal. The solution is going to be casting the variable code on the line. Try this:

shell = (int(*)()) code;

What we are doing is here casting code to be a function pointer which returns an integer... in effect will eventually allows us to execute our "shellcode". I suggest reading "Smashing the Stack for fun and profit" by Aleph1 one.