return to first page linux journal archive
keywordscontents

Listing 4. Pre-Write (prew.c)

#include <stdio.h>
#include <string.h>
/* Example of Pre-Write */
int main(void) 
{
   char *foo;
   foo = (char *) malloc(10);
   foo-;
   /* strcpy access before allocated area */
   strcpy(foo,"123456789");
   printf("%s\n",foo);
   free(foo);
   return(0);
}