# HG changeset patch # User frosch # Date 2024-01-17 21:26:33 # Node ID 139f88c72711085a01299e1bfd3c4655653bd87b # Parent 706f2f6ea5bacb095a59460768215d8246f025c3 Fix #11819, aa5ba5b: Out-of-bounds access in linkgraph GUI. (#11821) diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -680,7 +680,7 @@ void LinkGraphLegendWindow::UpdateOverla void LinkGraphLegendWindow::UpdateOverlayCargoes() { CargoTypes mask = 0; - for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + for (uint c = 0; c < num_cargo; c++) { if (!this->IsWidgetLowered(WID_LGL_CARGO_FIRST + c)) continue; SetBit(mask, _sorted_cargo_specs[c]->Index()); }