Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Stack Buffer OverFlow (http://www.go4expert.com/forums/stack-buffer-overflow-t19908/)

micsom_micsom 28Oct2009 17:30

Stack Buffer OverFlow
 
i was just going through one of the articles and i thought about trying this

char *pEvil="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzz";

int main(){
char Good[2];
strcpy(Good,pEvil);
return 1;
}

this will crash saying that it is unable to access the memory whose location is "zzzz" in hexa(This is the expected)..i was just trying to figure out how the ESP and EBP is getting Corrupted here...

can any1 plzz explain..:charming:

xpi0t0s 28Oct2009 17:55

Re: Stack Buffer OverFlow
 
Compile to assembly and you'll see exactly what is going on.

micsom_micsom 28Oct2009 17:58

Re: Stack Buffer OverFlow
 
i am Using Dev c++, i can't find any option to see the assembly Code ...

xpi0t0s 28Oct2009 18:56

Re: Stack Buffer OverFlow
 
"-o source.s" might do the trick. I don't know, I use Visual Studio.
Alternatively if you build the program, start it in debug mode and put a breakpoint on the first line of code, is there a "view assembler" option in the debugger?

micsom_micsom 28Oct2009 19:37

Re: Stack Buffer OverFlow
 
No such options ...


All times are GMT +5.5. The time now is 15:22.