Skip to content

Commit 6e2eafd

Browse files
committed
drop lines which are too long
1 parent 05d896b commit 6e2eafd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/settings.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,15 +890,24 @@ error_t settings_load_ovl(bool overlay)
890890
{
891891
if (read_length == SETTINGS_LOAD_BUFFER_LEN - 1)
892892
{
893-
TRACE_ERROR("Cannot read config file, line too big for buffer, cutting line %s\r\n", line);
893+
TRACE_ERROR("Cannot read config file, line too big for buffer, skipping line %s\r\n", line);
894+
while (fsReadFile(file, &buffer[0], 1, &read_length) == NO_ERROR)
895+
{
896+
if (line[0] == '\n')
897+
{
898+
break;
899+
}
900+
}
901+
from_read = 0;
902+
read_length = 0;
894903
}
895904
else
896905
{
897906
TRACE_WARNING("Last line of config is missing a newline %s\r\n", line);
898907
from_read++;
899908
read_length++;
909+
line[read_length - 1] = '\n';
900910
}
901-
line[read_length - 1] = '\n';
902911
}
903912
else
904913
{

0 commit comments

Comments
 (0)