It could just be writing through a bad pointer, but for that particular error it's often copying a string off the end of a block.
Using new it would be stuff like:

char *p=new char(4);
strcpy(p,"abc"); // damage block here

instead of

char *p=new char[4];
strcpy(p,"abc");

Another way is forgetting to allocate space for the trailing NULL. e.g.
char *p=new char[strlen("abc")];
strcpy(p,"abc");// 1 char too short, damages block


The principle is the same for malloc.

You can bracket potentially dodgy stuff with

ASSERT(AfxCheckMemory());

and in Debug runs the one that asserts will be the one following the bad operation. If you're not using MFC then you'd probably need to look at _CrtCheckMemory() instead (same idea though).


Cheers,
Roger