diff --git a/conf.c b/conf.c index 810989f..844150a 100644 --- a/conf.c +++ b/conf.c @@ -433,7 +433,7 @@ void CNF_ReadFile(const char *filename) { FILE *in; - char line[MAX_LINE_LENGTH]; + char line[MAX_LINE_LENGTH + 1]; int i; include_level++; @@ -463,6 +463,10 @@ CNF_ParseLine(const char *filename, int number, char *line) 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);