summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-06-15 13:04:07 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-06-15 13:04:07 +0000
commit980a2edce8fd7c33c8f36071f9c59ecd2a88cac4 (patch)
tree9ef029827f2211ad999c5a1f25d778f4f769de58 /src
parent4f372c38184ec7d6748d68d4b4b0801c0632c5ed (diff)
Nicer SQLQuery::Sanitise
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4006 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_sql.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/modules/extra/m_sql.h b/src/modules/extra/m_sql.h
index 2e185d978..519b28f33 100644
--- a/src/modules/extra/m_sql.h
+++ b/src/modules/extra/m_sql.h
@@ -234,21 +234,27 @@ class SQLQuery
static std::string Sanitise(const std::string& crap)
{
- std::string temp = "";
- for (unsigned int q = 0; q < crap.length(); q++)
- {
- if (crap[q] == '\'')
+ std::string temp = "";
+ for (unsigned int q = 0; q < crap.length(); q++)
+ {
+ if (crap[q] == '\'')
{
- temp = temp + "\'";
+ temp += "\\'";
}
- else if (crap[q] == '"')
+ else if (crap[q] == '"')
{
- temp = temp + "\\\"";
+ temp += "\\\"";
}
- else
- temp = temp + crap[q];
- }
- return temp;
+ else if (crap[q] == '\\')
+ {
+ temp += "\\\\";
+ }
+ else
+ {
+ temp += crap[q];
+ }
+ }
+ return temp;
}
};