esp int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } eip 100:...

15
ES P int f(int x) { .... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EI P 100 : 200 : 250 : 300 : 350 :

Upload: ashley-lucas

Post on 24-Dec-2015

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

ESPint f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

EIP

100:

200:

250:

300:

350:

Page 2: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1ESP

EIP

100:

200:

250:

300:

350:

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 3: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to mainESP

EIP

100:

200:

250:

300:

350:

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 4: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to mainESP

EIP

100:

200:

250:

300:

350:

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 5: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBPESP

EIP

100:

200:

250:

300:

350:

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 6: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBPESP

EIP

100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 7: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local VariablesESP

EIP

100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 8: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local VariablesESP EIP

100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 9: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2ESPEIP

100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 10: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2return address to gESP

EIP

100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 11: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2return address to gESP

100:

200:

250:

300:

350:

EBP

EIP int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 12: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2return address to g

Old EBPESP

EIP 100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 13: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2return address to g

Old EBPESP

EIP 100:

200:

250:

300:

350:

EBP

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

Page 14: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2return address to g

Old EBP

ESI

EDIEBX

Local VariablesESP

100:

200:

250:

300:

350:

EIP int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

EBP

Page 15: ESP int f(int x) {.... } int g(int y) { …. f(2); …. } int main() { …. g(1); …. } EIP 100: 200: 250: 300: 350:

1return address to main

Old EBP

ESI

EDI

EBX

Local Variables

2return address to g

Old EBP

ESI

EDIEBX

Local VariablesESP

100:

200:

250:

300:

350:

EIP

Function Frames

int f(int x){....}

int g(int y){ …. f(2); ….}

int main(){ …. g(1); ….}

EBP