Skip to content

Commit

Permalink
IcingaDB::PrepareObject(): cut off (null) negative Notification#times…
Browse files Browse the repository at this point in the history
….{begin,end} not to crash Go daemon

At least our PostgreSQL schema enforces positive values.
  • Loading branch information
Al2Klimov committed Jun 27, 2023
1 parent 10fedc1 commit 992e412
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,8 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
auto begin (notification->GetTimes()->Get("begin"));
auto end (notification->GetTimes()->Get("end"));

attributes->Set("times_begin", begin == Empty ? Empty : Value(std::round((double)begin)));
attributes->Set("times_end", end == Empty ? Empty : Value(std::round((double)end)));
attributes->Set("times_begin", begin == Empty || (double)begin < 0 ? Empty : Value(std::round((double)begin)));
attributes->Set("times_end", end == Empty || (double)end < 0 ? Empty : Value(std::round((double)end)));
}

attributes->Set("notification_interval", notification->GetInterval());
Expand Down

0 comments on commit 992e412

Please sign in to comment.