Skip to content

Commit dd51b81

Browse files
committed
IcingaDB#SerializeState(): limit execution_time and latency to 2^32-1
not to write higher values into Redis than the Icinga DB schema can hold. This fixes yet another potential Go daemon crash.
1 parent 6b4378d commit dd51b81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/icingadb/icingadb-objects.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,8 +2644,8 @@ Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable)
26442644

26452645
if (!cr->GetCommand().IsEmpty())
26462646
attrs->Set("check_commandline", FormatCommandLine(cr->GetCommand()));
2647-
attrs->Set("execution_time", TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime())));
2648-
attrs->Set("latency", TimestampToMilliseconds(cr->CalculateLatency()));
2647+
attrs->Set("execution_time", std::min((long long)UINT32_MAX, TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime()))));
2648+
attrs->Set("latency", std::min((long long)UINT32_MAX, TimestampToMilliseconds(cr->CalculateLatency())));
26492649
attrs->Set("check_source", cr->GetCheckSource());
26502650
attrs->Set("scheduling_source", cr->GetSchedulingSource());
26512651
}

0 commit comments

Comments
 (0)