-
-
未解决
[求助]关于Q版缓冲区溢出这本书在堆溢出章节的代码问题
-
发表于:
2018-11-13 10:48
2043
-
未解决 [求助]关于Q版缓冲区溢出这本书在堆溢出章节的代码问题
一下为完整代码
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
char mybuf[]="ww0830";
int main(int argc,char * argv[])
{
HANDLE hHeap;
char *buf1,*buf2;
hHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0x10000,0xfffff);
printf("mybuf addr = %p\n",mybuf);
buf1=HeapAlloc(hHeap,0,200);
strcpy(buf1,mybuf);
printf("buf1=%s\n",buf1);
buf2=HeapAlloc(hHeap,0,16);
HeapFree(hHeap,0,buf1);
HeapFree(hHeap,0,buf2);
return 0;
}
错误提示是
error C2440: '=' : cannot convert from 'void *' to 'char *'
错误语句是
buf1=HeapAlloc(hHeap,0,200);
请问这里怎么改?
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)