From 5e5d2e2f72f9c0a0c3fc7f028548b9868e411fb0 Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sun, 12 Mar 2023 17:01:04 +0100 Subject: [PATCH] Fix timezone config parser (#2169) * make sure to parse the whole config line * fix crash on empty timezone parameter --------- Co-authored-by: CaCO3 --- code/components/jomjol_time_sntp/time_sntp.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/components/jomjol_time_sntp/time_sntp.cpp b/code/components/jomjol_time_sntp/time_sntp.cpp index 8a92c2c0..78df9d5b 100644 --- a/code/components/jomjol_time_sntp/time_sntp.cpp +++ b/code/components/jomjol_time_sntp/time_sntp.cpp @@ -175,10 +175,15 @@ bool setupTime() { while (configFile.getNextLine(&line, disabledLine, eof) && !configFile.isNewParagraph(line)) { - splitted = ZerlegeZeile(line); + splitted = ZerlegeZeile(line, "="); if (toUpper(splitted[0]) == "TIMEZONE") { - timeZone = splitted[1]; + if (splitted.size() <= 1) { // parameter part is empty + timeZone = ""; + } + else { + timeZone = splitted[1]; + } } if (toUpper(splitted[0]) == "TIMESERVER") {