From 64907ebf5cd6b10ff8d09001f60621220c31b890 Mon Sep 17 00:00:00 2001 From: xHire Date: Tue, 16 May 2017 09:01:45 +0200 Subject: [PATCH] Slightly better handling of incorrect config files --- src/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index 4b7118e..cb786ce 100644 --- a/src/config.c +++ b/src/config.c @@ -98,7 +98,7 @@ int cfg_parse(const char *config_file, unsigned short *cmtu, /* comments */ if (c == '#') { /* skip this line */ - while (c = getc(f), c != '\n'); + while (c = getc(f), c != '\n' && !feof(f)); continue; } @@ -155,7 +155,7 @@ int cfg_parse(const char *config_file, unsigned short *cmtu, /* skip rest of this line */ if (c != '\n') { - while (c = getc(f), c != '\n'); + while (c = getc(f), c != '\n' && !feof(f)); } /* recognize the option */