/*
* fortune file scanning, read string in memory
*/
fortunefile = fopen(file,"r");
if (fortunefile == NULL) { /* on open error exit */
/*
* fortune file scanning, read string in memory
*/
fortunefile = fopen(file,"r");
if (fortunefile == NULL) { /* on open error exit */
- fortune[i] = (char *) malloc(strlen(line)+1);
- strncpy(fortune[i], line, strlen(line)+1);
+ fortune[i] = malloc(len);
+ strncpy(fortune[i], line, len);
- fortune[i] = (char *) realloc(fortune[i], strlen(line)+1);
- strncat(fortune[i], line, strlen(line)+1);
+ fortune[i] = realloc(fortune[i], strlen(fortune[i])+len+1);
+ strncat(fortune[i], line, len);