From f457be5a27439f2cbb276b3d5c731941687d286a Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 17 Jan 2024 22:26:33 +0100 Subject: [PATCH] Fix #11819, aa5ba5b: Out-of-bounds access in linkgraph GUI. (#11821) --- src/linkgraph/linkgraph_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index b00f78ac9c..883484c26a 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -680,7 +680,7 @@ void LinkGraphLegendWindow::UpdateOverlayCompanies() 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()); }