Un detalle, para el que quiera que funcione cuando lo corras fuera del debugger, tienes que juntarse a su proceso. Os pongo el ejemplo:
Citar
sagrini@sagrini:~/Escritorio/OverFlow/Cap2$ sudo ./serv 80 &
[1] 5166
SmallServ 2.0 - By Sagrini - Sagrini 2010 - 22/03/2011 18:09:26
sagrini@sagrini:~/Escritorio/OverFlow/Cap2$ sudo gdb -q -pid=5166 --symbols=./serv
Attaching to process 5166
Load new symbol table from "/home/sagrini/Escritorio/OverFlow/Cap2/serv"? (y or n) y
0xb783d430 in __kernel_vsyscall ()
(gdb) c
Continuing.
22/03/2011 18:10:08 Got connection from 127.0.0.1:49484
Program received signal SIGSEGV, Segmentation fault.
0xb76f83c1 in getenv () from /lib/tls/i686/cmov/libc.so.6
(gdb) x/5000b $esp
[...]
0xbfe1a0b0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0b8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0c0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0c8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0d0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0d8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0e0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0e8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0f0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0f8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a100: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a108: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a110: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
[...]
(gdb)
---------------------------------------------------------
sagrini@sagrini:~$ perl -e 'print "A"x1040' | hK vc 127.0.0.1 80
hK 2.0 - By Sagrini (2010) - 22/03/2011 18:12:23
22/03/2011 18:12:23 Got connection with 127.0.0.1:80
[1] 5166
SmallServ 2.0 - By Sagrini - Sagrini 2010 - 22/03/2011 18:09:26
sagrini@sagrini:~/Escritorio/OverFlow/Cap2$ sudo gdb -q -pid=5166 --symbols=./serv
Attaching to process 5166
Load new symbol table from "/home/sagrini/Escritorio/OverFlow/Cap2/serv"? (y or n) y
0xb783d430 in __kernel_vsyscall ()
(gdb) c
Continuing.
22/03/2011 18:10:08 Got connection from 127.0.0.1:49484
Program received signal SIGSEGV, Segmentation fault.
0xb76f83c1 in getenv () from /lib/tls/i686/cmov/libc.so.6
(gdb) x/5000b $esp
[...]
0xbfe1a0b0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0b8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0c0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0c8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0d0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0d8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0e0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0e8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0f0: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a0f8: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a100: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a108: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
0xbfe1a110: 0x41 0x41 0x41 0x41 0x41 0x41 0x41 0x41
[...]
(gdb)
---------------------------------------------------------
sagrini@sagrini:~$ perl -e 'print "A"x1040' | hK vc 127.0.0.1 80
hK 2.0 - By Sagrini (2010) - 22/03/2011 18:12:23
22/03/2011 18:12:23 Got connection with 127.0.0.1:80
Un saludo
Sagrini