中间没有任何调用bad的代码,但是实际执行的时候bad被调用
#include <stdio.h>
#include <string.h>
void bad() {
printf("Oh shit really bad~!\r\n");
}
void foo() {
char overme[4] = "WOW";
*(int*)(overme+8) = (int)bad;
}
int main() {
foo();
}
更新
在x86-64,offset应该是24,也就是overme+8=>overme+24
