Code: Select all
#include <stdio.h>
void return_input(void)
{
char array[30];
gets(array);
printf("%s\n", array);
}
main()
{
return_input();
return 0;
}
Code: Select all
C:\test>printf "AAAAAAAAAABBBBBBBBBCCCCCCCCCCCCCDDDDDDD\xb5\x13\x40\x00" | first.exe
What it should do is output the string twice it only does it once then it crashes. Not sure if this is cause of some windows protection.Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\maboroshi>cd C:\test
C:\test>gdb first.exe
Reading symbols from c:\test\first.exe...done.
(gdb) disas main
Dump of assembler code for function main:
0x004013aa <+0>: push %ebp
0x004013ab <+1>: mov %esp,%ebp
0x004013ad <+3>: and $0xfffffff0,%esp
0x004013b0 <+6>: call 0x4018e0 <__main>
0x004013b5 <+11>: call 0x40138c <return_input>
0x004013ba <+16>: mov $0x0,%eax
0x004013bf <+21>: leave
0x004013c0 <+22>: ret
0x004013c1 <+23>: nop
0x004013c2 <+24>: nop
0x004013c3 <+25>: nop
End of assembler dump.
(gdb)
Any ideas
*cheers
Mabo