mirror of
https://github.com/znc/znc.git
synced 2026-05-05 13:02:31 +02:00
Don't let attackers inject rogue values into znc.conf
Because of this vulnerability, existing ZNC users could get Admin permissions. Thanks for Jeriko One <jeriko.one@gmx.us> for finding and reporting this.
This commit is contained in:
@@ -174,9 +174,14 @@ bool CConfig::Parse(CFile& file, CString& sErrorMsg) {
|
||||
void CConfig::Write(CFile& File, unsigned int iIndentation) {
|
||||
CString sIndentation = CString(iIndentation, '\t');
|
||||
|
||||
auto SingleLine = [](const CString& s) {
|
||||
return s.Replace_n("\r", "").Replace_n("\n", "");
|
||||
};
|
||||
|
||||
for (const auto& it : m_ConfigEntries) {
|
||||
for (const CString& sValue : it.second) {
|
||||
File.Write(sIndentation + it.first + " = " + sValue + "\n");
|
||||
File.Write(SingleLine(sIndentation + it.first + " = " + sValue) +
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,9 +189,11 @@ void CConfig::Write(CFile& File, unsigned int iIndentation) {
|
||||
for (const auto& it2 : it.second) {
|
||||
File.Write("\n");
|
||||
|
||||
File.Write(sIndentation + "<" + it.first + " " + it2.first + ">\n");
|
||||
File.Write(SingleLine(sIndentation + "<" + it.first + " " +
|
||||
it2.first + ">") +
|
||||
"\n");
|
||||
it2.second.m_pSubConfig->Write(File, iIndentation + 1);
|
||||
File.Write(sIndentation + "</" + it.first + ">\n");
|
||||
File.Write(SingleLine(sIndentation + "</" + it.first + ">") + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user