If the buffer filled by fgets() is full, indicating it might not contain
the whole line, abort with a fatal message.
CNF_ReadFile(const char *filename)
{
FILE *in;
- char line[MAX_LINE_LENGTH];
+ char line[MAX_LINE_LENGTH + 1];
int i;
include_level++;
processed_file = filename;
line_number = number;
+ /* Detect truncated line */
+ if (strlen(line) >= MAX_LINE_LENGTH)
+ other_parse_error("String too long");
+
/* Remove extra white-space and comments */
CPS_NormalizeLine(line);