Skip to content

Commit

Permalink
IcingaDB#SerializeState(): limit execution_time and latency to 2^32-1
Browse files Browse the repository at this point in the history
not to write higher values into Redis than the Icinga DB schema can hold.
This fixes yet another potential Go daemon crash.
  • Loading branch information
Al2Klimov committed May 15, 2024
1 parent cb945fe commit 3318871
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 @@ -2642,8 +2642,8 @@ Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable)

if (!cr->GetCommand().IsEmpty())
attrs->Set("check_commandline", FormatCommandLine(cr->GetCommand()));
attrs->Set("execution_time", TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime())));
attrs->Set("latency", TimestampToMilliseconds(cr->CalculateLatency()));
attrs->Set("execution_time", std::min(UINT32_MAX, TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime()))));
attrs->Set("latency", std::min(UINT32_MAX, TimestampToMilliseconds(cr->CalculateLatency())));
attrs->Set("check_source", cr->GetCheckSource());
attrs->Set("scheduling_source", cr->GetSchedulingSource());
}
Expand Down

0 comments on commit 3318871

Please sign in to comment.