From badf19b424aaffb5674809eb449ded8c2a87e7a9 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 7 Sep 2021 01:18:13 -0400 Subject: [PATCH] tweak military-assign: fix likely missing bounds check --- plugins/tweak/tweaks/military-assign.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tweak/tweaks/military-assign.h b/plugins/tweak/tweaks/military-assign.h index 45f97eac3..92b101e08 100644 --- a/plugins/tweak/tweaks/military-assign.h +++ b/plugins/tweak/tweaks/military-assign.h @@ -77,7 +77,7 @@ struct military_assign_hook : df::viewscreen_layer_militaryst { int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible(); int si = plist->getListCursor(); - for (int y = y1, i = i1; i <= i2; i++, y++) + for (int y = y1, i = i1; i <= i2 && y <= y2; i++, y++) { auto unit = vector_get(positions.candidates, i); if (!unit || unit->military.squad_id < 0)