Reverse Engineering for Beginners

(avery) #1

CHAPTER 18. ARRAYS CHAPTER 18. ARRAYS


Let’s trace further and see how it gets restored:


Figure 18.4:OllyDbg: restoring value of EBP

Indeed, how it could be different? The compiler may generate some additional code to check the index value to be always
in the array’s bounds (like in higher-level programming languages^3 ) but this makes the code slower.


18.2.2 Writing beyond array bounds


OK, we read some values from the stackillegally, but what if we could write something to it?


Here is what we have got:


#include <stdio.h>


int main()
{
int a[20];
int i;


for (i=0; i<30; i++)
a[i]=i;

return 0;
};


MSVC


And what we get:


(^3) Java, Python, etc

Free download pdf