|
|||||||||||
|
N00b questions :\
From: Diode Trnasistor <ffddfe(at)yahoo.com>
Date: Sat May 24 2003 - 19:52:52 EDT I wrote a simple program i was hoping will demonstrate the standard stack based overflow for me. It looks like this: void main() {
char buffer[12];
memset(longbuffer, 'A', 30);
strcpy(buffer, longbuffer);
After compilation, inside gdb, disassemble main i get this: 0x8048440...etc etc. Now up untill main+3 it makes sense. Why is this enormous number being added to stack pointer is beyond me. Shouldn't this completelly ruin the stack? Doesn't the stack start at the highest adress and grow down? WTF? Moving on i write another sample program: void function(int i, int b, int c) {
char buffer[12];
return;
int main(void) {
function(1, 2, 3);
disassemble function with gdb yields: 0x80483d0...etc etc WTF?! ok so it sets up a new stack frame and then makes room for the local auto variables. Now i'm not very good at math but last i checked 12 + 8 made 20. Not 40. Again, WTF? Is gentoo using unicode or something crazy like that? God i cry...
And what happens? Segmentation fault 0x41414141 in
strcpy? Hell no! I get a completelly baffling:
Segmentation fault.
0x40085013? _IO_getline_info? Where did that come from? Looking at begining of vulndev2.c..
main(int argc, char *argv[])
char *bfp;
char buf[BFSIZE];
FILE *f1;
I'd assume that buf was on the stack. Why doesn't writing WAY past the end of this buffer cause a jump to 41414141? I am SO confused HALP! PS: i'm a n00b :\
Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com Received on Sat May 24 20:17:16 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:39 EDT |
||||||||||
|
|||||||||||