mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 19:05:06 -05:00
conf: require sourcedir files to be terminated by newline
When reading a *.sources file require that each line is termined by the newline character to avoid processing an unfinished line, e.g. due to an unexpected call of the reload command when the file is being written in place.
This commit is contained in:
5
conf.c
5
conf.c
@@ -1694,8 +1694,9 @@ load_source_file(const char *filename)
|
||||
return;
|
||||
|
||||
while (fgets(line, sizeof (line), f)) {
|
||||
if (strlen(line) >= MAX_LINE_LENGTH)
|
||||
continue;
|
||||
/* Require lines to be terminated */
|
||||
if (line[0] == '\0' || line[strlen(line) - 1] != '\n')
|
||||
break;
|
||||
|
||||
CPS_NormalizeLine(line);
|
||||
if (line[0] == '\0')
|
||||
|
||||
Reference in New Issue
Block a user