Przeglądaj źródła

Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
CaCO3 2 lat temu
rodzic
commit
5e5d2e2f72
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7 2
      code/components/jomjol_time_sntp/time_sntp.cpp

+ 7 - 2
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") {