具有挑战性的题目解决办法
具有挑战性的题目
int main()
{
int x;
x =1;
func(8,7,9);
x =2;
printf("%d",x);
return 0;
}
编写func函数,使得printf输出1
------解决方案--------------------
越界,然后覆盖后面的代码
------解决方案--------------------
int main()
{
int x;
x =1;
func(8,7,9);
x =2;
printf("%d",x);
return 0;
}
编写func函数,使得printf输出1
------解决方案--------------------
越界,然后覆盖后面的代码
------解决方案--------------------
- C/C++ code
void func(int, int, int) { __asm{ mov eax, esp;//save the current esp; add esp,0xd0;//seek the ip esp; pop ebx; add ebx,0x0a; push ebx; mov esp, eax; } }