From 45ea29a76012ac85d03498517e11650ff5231dd5 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Thu, 8 Oct 2020 19:54:38 +0200 Subject: [PATCH] fixed infinite loop config files bigger than 512B would cause an infinite loop for a missing else statement, oops. --- hkd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hkd.c b/hkd.c index 927a495..b383e0b 100644 --- a/hkd.c +++ b/hkd.c @@ -749,7 +749,7 @@ void parse_config_file (void) // First state case 0: // remove whitespaces - while (isblank(*bb)) + while (isblank(*bb) && *bb) bb++; // get state switch (*bb) { @@ -760,6 +760,8 @@ void parse_config_file (void) // If it is the end of the last block exit if (exit_state > 1) exit_state = -1; + else + exit_state = 1; break; case '\n': case '#':