void function(int a, int b, int c) {
char buffer1[5];
char buffer2[10];
int *ret;
ret = buffer1 + 12;
(*ret) += 8;
}
void main() {
int x;
x = 0;
function(1,2,3);
x = 1;
printf("%d\n",x);
}
I found this code on smashing the stack tutorial and the code given here is expected to jump"x=1;" assignment statement but the code is not working as desired... anyone please help in explaining and correcting this buffer overflow sample code.