Skip to content

Commit

Permalink
Fix timezone config parser (#2169)
Browse files Browse the repository at this point in the history
* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
  • Loading branch information
caco3 and CaCO3 authored Mar 12, 2023
1 parent 512d7f9 commit 5e5d2e2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/components/jomjol_time_sntp/time_sntp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 5e5d2e2

Please sign in to comment.