Vulnerability Development mailing list archives

Re: regarding phrack49's stack smashing tutorial


From: peak () ARGO TROJA MFF CUNI CZ (Pavel Kankovsky)
Date: Sun, 14 May 2000 20:52:45 +0200


On Sat, 13 May 2000, Christian Hammers wrote:

Now I wonder about the following sentences:
      "The answer is that for every program the stack will start at
      the same address."
Why does it and more specific *where*? I wrote some test programs and
saw that is always 0xbffff6c6 +- 0xff. But it changes sometimes.

The address is not fixed because it depends on the size of supplied
arguments and environment variables -- the kernel puts them at the top
of the stack (at least on Linux but I think other unix systems do it as
well)...

$ cat > stk.c <<EOF
#include <stdio.h>
int main() { int a; printf("%p\n", &a); return 0; }
EOF
$ cc -o stk stk.c
$ ./stk
0xbffff88c
$ A=dfshjgsdfkghhfdk ./stk
0xbffff87c
$ ./stk fdgdfdffdsgfdgd
0xbffff87c
$ A=dfshjgsdfkghhfdk ./stk fdgdfdffdsgfdgd
0xbffff864

--Pavel Kankovsky aka Peak  [ Boycott Microsoft--http://www.vcnet.com/bms ]
"Resistance is futile. Open your source code and prepare for assimilation."


Current thread: