overflow technique in stack
- by metashockwave
int main(void) {
problem2();
}
void doit2(void) {
int overflowme[16];
//overflowme[37] =0;
}
void problem2(void) {
int x = 42;
doit2();
printf("x is %d\n", x);
printf("the address of x is 0x%x\n", &x);
}
Would someone help me understand why overflowme[37] =0; from the doit2 function will overwrite the value of x? (please include Program Counter and Frame Pointer of the function doit2 in your explanation) Thank you!
It works every time with Project properties-Configuration properties-C/C++ -Code Generation-Basic Runtime Checks set to "Default". so it's not an undefined behavior.