-const char filters_rcs[] = "$Id: filters.c,v 1.191 2014/10/18 11:28:36 fabiankeil Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.192 2014/10/18 11:30:24 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
return NULL;
}
- filter_output = malloc_or_die(*size);
+ /* Allocate at least one byte */
+ filter_output = malloc_or_die(*size + 1);
new_size = 0;
while (!feof(fp) && !ferror(fp))
char *p;
/* Could be considered wasteful if the content is 'large'. */
- *size = (*size != 0) ? *size * 2 : READ_LENGTH;
+ *size = (*size > READ_LENGTH) ? *size * 2 : READ_LENGTH;
p = realloc(filter_output, *size);
if (p == NULL)