From 609255f63108a9ba3d746aa63f580ce5a32b10c7 Mon Sep 17 00:00:00 2001 From: jrd Date: Sun, 30 Aug 2026 15:33:15 +0000 Subject: [PATCH] settings.cpp: bound customdirectoryindex by the vector it indexes GetNumericIniSet's upper bound is inclusive and MAX_NUM_SERVER_ADDR_ITEMS is the element count of vstrDirectoryAddress, so the value one past the end was accepted from the settings file and then used as a subscript, crashing the client at startup in CConnectDlg::RequestServerList. Fixes #3917. --- src/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.cpp b/src/settings.cpp index bdc453913e..dc725c1b76 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -783,7 +783,7 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, // custom directory index if ( ( eDirectoryType == AT_CUSTOM ) && - GetNumericIniSet ( IniXMLDocument, "client", "customdirectoryindex", 0, MAX_NUM_SERVER_ADDR_ITEMS, iValue ) ) + GetNumericIniSet ( IniXMLDocument, "client", "customdirectoryindex", 0, MAX_NUM_SERVER_ADDR_ITEMS - 1, iValue ) ) { iCustomDirectoryIndex = iValue; }