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 415b810 commit dccb678
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,11 +1386,11 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
auto begin (notification->GetTimes()->Get("begin"));
auto end (notification->GetTimes()->Get("end"));

if (begin != Empty) {
if (begin != Empty && (double)begin >= 0) {
attributes->Set("times_begin", std::round((double)begin));
}

if (end != Empty) {
if (end != Empty && (double)end >= 0) {
attributes->Set("times_end", std::round((double)end));
}
}
Expand Down

0 comments on commit dccb678

Please sign in to comment.