以下代码引发了“缓冲区溢出”警告消息。如果有人通过此代码段识别出问题,将会很有帮助。
int *index;
UINT tasks = 1024;
index = (int*)malloc( tasks * sizeof(int));
for (UINT ixFree = 0; ixFree < tasks; ixFree++)
index[ixFree] = ixFree; //Warning C6386 Buffer overrun while writing to 'index': the writable size is 'tasks*sizeof(int)' bytes, but '8' bytes might be written.
谢谢