conf: detect truncated lines
If the buffer filled by fgets() is full, indicating it might not contain the whole line, abort with a fatal message.
This commit is contained in:
parent
951f14ae06
commit
ea4811b3b3
1 changed files with 5 additions and 1 deletions
6
conf.c
6
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue