From bb567c51def25b182b9d0178fd71c291ecffafa6 Mon Sep 17 00:00:00 2001 From: cflakes Date: Sat, 1 May 2010 18:36:05 +0000 Subject: [PATCH] We now trim all leading and trailing spaces from parameter values passed into webadmin/webmods. This makes sense in almost every case, be it that users accidentally hit the space bar or try to outsmart ZNC by entering nothing but spaces into a textbox. By doing the latter, it was possible to trick ZNC into not starting up again. Thanks to Redirect_ for bringing this to our attention. Another commit that will fix the underlying problem while writing to the config file will follow. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1961 726aef4b-f618-498e-8847-2d620e286838 --- HTTPSock.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HTTPSock.cpp b/HTTPSock.cpp index 575fafd1..065c6d7e 100644 --- a/HTTPSock.cpp +++ b/HTTPSock.cpp @@ -325,6 +325,7 @@ CString CHTTPSock::GetParam(const CString& sName, bool bPost, const CString& sFi CString CHTTPSock::GetParam(const CString& sName, const map& msvsParams, const CString& sFilter) { CString sRet = GetRawParam(sName, msvsParams); + sRet.Trim(); for (size_t i = 0; i < sFilter.length(); i++) { sRet.Replace(CString(sFilter.at(i)), ""); @@ -347,6 +348,7 @@ unsigned int CHTTPSock::GetParamValues(const CString& sName, set& ssRet if (it != msvsParams.end()) { for (unsigned int a = 0; a < it->second.size(); a++) { CString sParam = it->second[a]; + sParam.Trim(); for (size_t i = 0; i < sFilter.length(); i++) { sParam.Replace(CString(sFilter.at(i)), ""); @@ -372,6 +374,7 @@ unsigned int CHTTPSock::GetParamValues(const CString& sName, VCString& vsRet, co if (it != msvsParams.end()) { for (unsigned int a = 0; a < it->second.size(); a++) { CString sParam = it->second[a]; + sParam.Trim(); for (size_t i = 0; i < sFilter.length(); i++) { sParam.Replace(CString(sFilter.at(i)), "");