Figure 3: Memory overwrite in C

/* To compile: CRTBNDC PGM(EXAMPLE3) */
#include 
#include 

int main (int argc, char *argv[])
{
  char *ptr = (char*)malloc(13);

  /* strcpy() copies the trailing NULL character */
  strcpy(ptr, "abcdefghijklm");  /* memory overwrite */
  free(ptr);
  return 0;
}