From 1fd22431a0ec4ed9722bb82b85ed952fcf6703d5 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 16 Jul 2010 21:01:50 +0000 Subject: [PATCH] Fix a std::out_of_range error in partyline If the CHANTYPES token was the last one in a 005 numeric, partyline would call std::insert() with CString::npos for the position to insert at. This throws a std::out_of_range error. Fix this by using CString::append() in this case. Thanks to Superfly_ for the bug report and helping me reproduce this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2087 726aef4b-f618-498e-8847-2d620e286838 --- modules/partyline.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/partyline.cpp b/modules/partyline.cpp index 2cd952e1..0a93c2b4 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -168,7 +168,10 @@ public: if (uPos != CString::npos) { uPos = sLine.find(" ", uPos); - sLine.insert(uPos, CHAN_PREFIX_1); + if (uPos == CString::npos) + sLine.append(CHAN_PREFIX_1); + else + sLine.insert(uPos, CHAN_PREFIX_1); m_spInjectedPrefixes.insert(m_pUser); } }