Message: add bounds check in GetParamsColon when uIdx >= params.size()

Without this check, when uIdx >= m_vsParams.size() and the vector is
non-empty, the subtraction in the clamp condition underflows to SIZE_MAX.
GetParamsSplit() already has the equivalent check at the top of the
function; this brings GetParamsColon() in line with it.

Fixes #1994
This commit is contained in:
jabberwock
2026-03-17 08:52:33 -07:00
parent 55d34645de
commit 94aeaa02bf

View File

@@ -51,7 +51,7 @@ void CMessage::SetCommand(const CString& sCommand) {
}
CString CMessage::GetParamsColon(unsigned int uIdx, unsigned int uLen) const {
if (m_vsParams.empty() || uLen == 0) {
if (m_vsParams.empty() || uLen == 0 || uIdx >= m_vsParams.size()) {
return "";
}
if (uLen > m_vsParams.size() - uIdx - 1) {