From 3e94285e3bc6edea0871735d28921bd0cbe29557 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 27 Feb 2023 23:07:04 +0300 Subject: [PATCH] Fix pipboy hotline buttons buffer overread Closes #50 --- src/game/pipboy.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/pipboy.cc b/src/game/pipboy.cc index 43a3a46..0c203f9 100644 --- a/src/game/pipboy.cc +++ b/src/game/pipboy.cc @@ -2015,7 +2015,12 @@ static void AddHotLines(int start, int count, bool add_back_button) static void NixHotLines() { if (hot_line_count != 0) { - for (int index = hot_line_start; index < hot_line_start + hot_line_count; index++) { + int end = hot_line_start + hot_line_count; + if (end > 20) { + end = 20; + } + + for (int index = hot_line_start; index < end; index++) { win_delete_button(HotLines[index]); } }