title: c stack variable corrupted
body: <p>I have read all question for this type of problem but I can't fix mine. 
  The problem is that I use a function for reading data from  a file and I get this error:
  "Stack around variable 'p' was corrupted"
  This is the function</p>
  
  <pre><code>Firm readFirm(char* name)
  {
  FILE* file = NULL;
  int i = 0;
  Firm firm;
  char line[100];
  char* p[5] = {(char*)malloc(50)};
  
  char tmp[50];
  strcpy(tmp,name);
  strcat(tmp,".txt");
  file = fopen(tmp,"rb");
  
  getline(file,line,100);
  strcpy(firm.name,line);
  getline(file,line,100);
  strcpy(firm.EIK,line);
  getline(file,line,100);
  split(p,line," ");
  for (i = 0 ; p[i] != NULL; i++)
      firm.price[i] = atoi(p[i]);
  getline(file,line,100);
  
  split(p,line,".");
  firm.day = atoi(p[0]);
  firm.month = atoi(p[1]);
  firm.year = atoi(p[2]);
  fclose(file);
  return firm;
  
  }
  </code></pre>
  
  <p>Please help because I don't know how to fix it!</p>
  
  <p>This is the split function:</p>
  
  <pre><code>char ** split( char *result[], char *w, const char *delim)
  {
  int i=0;
  char *p=NULL;
  for(i=0, result[0]=NULL, p=strtok(w, delim); p!=NULL; p=strtok(NULL, delim), i++ )
  {
         result[i]=p;
         result[i+1]=NULL;
  }
  return result;
  }
  </code></pre>