1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 16:36:39 +02:00

Make the RPC API sanitize automatically.

This commit is contained in:
Sadie Powell
2025-02-13 01:54:57 +00:00
parent f8c1b8f4f9
commit 1e82b4075e
3 changed files with 18 additions and 20 deletions
+2 -2
View File
@@ -54,7 +54,7 @@ public:
this->events.erase(it);
}
Anope::string Sanitize(const Anope::string &string) override
static Anope::string Sanitize(const Anope::string &string)
{
Anope::string ret = string;
for (int i = 0; !special[i].character.empty(); ++i)
@@ -189,7 +189,7 @@ public:
Anope::string r = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<methodResponse>\n<params>\n<param>\n<value>\n<struct>\n";
for (const auto &[name, value] : request.get_replies())
r += "<member>\n<name>" + name + "</name>\n<value>\n<string>" + this->Sanitize(value) + "</string>\n</value>\n</member>\n";
r += "<member>\n<name>" + this->Sanitize(name) + "</name>\n<value>\n<string>" + this->Sanitize(value) + "</string>\n</value>\n</member>\n";
r += "</struct>\n</value>\n</param>\n</params>\n</methodResponse>";
request.r.Write(r);