mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 18:55:39 +08:00
Close a SQL injection loophole in the new database driver
This commit is contained in:
@@ -216,11 +216,12 @@ namespace OpenSim.Data.MySQL
|
||||
foreach (KeyValuePair<string, string> kvp in data)
|
||||
{
|
||||
names.Add(kvp.Key);
|
||||
values.Add(kvp.Value);
|
||||
values.Add("?" + kvp.Key);
|
||||
cmd.Parameters.AddWithValue("?" + kvp.Key, kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("','", values.ToArray()) + "')";
|
||||
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user