aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAssetData.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-07-24 20:01:17 +0000
committerJustin Clarke Casey2009-07-24 20:01:17 +0000
commitc3bb9ec42ccc86d55055494bad31835a0fae00d2 (patch)
tree4cbad1bb4b0ebf797d80c71d4749ee7af02b50f4 /OpenSim/Data/MySQL/MySQLAssetData.cs
parent* Extend mssql name string size checking to create/update folder (diff)
downloadopensim-SC-c3bb9ec42ccc86d55055494bad31835a0fae00d2.zip
opensim-SC-c3bb9ec42ccc86d55055494bad31835a0fae00d2.tar.gz
opensim-SC-c3bb9ec42ccc86d55055494bad31835a0fae00d2.tar.bz2
opensim-SC-c3bb9ec42ccc86d55055494bad31835a0fae00d2.tar.xz
* Apply asset and inventory name and description bound checks to MySQL
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index c22f645..26cdd06 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -210,6 +210,20 @@ namespace OpenSim.Data.MySQL
210 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", 210 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)",
211 _dbConnection.Connection); 211 _dbConnection.Connection);
212 212
213 string assetName = asset.Name;
214 if (asset.Name.Length > 64)
215 {
216 assetName = asset.Name.Substring(0, 64);
217 m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
218 }
219
220 string assetDescription = asset.Description;
221 if (asset.Description.Length > 64)
222 {
223 assetDescription = asset.Description.Substring(0, 64);
224 m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
225 }
226
213 // need to ensure we dispose 227 // need to ensure we dispose
214 try 228 try
215 { 229 {
@@ -218,8 +232,8 @@ namespace OpenSim.Data.MySQL
218 // create unix epoch time 232 // create unix epoch time
219 int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); 233 int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000);
220 cmd.Parameters.AddWithValue("?id", asset.ID); 234 cmd.Parameters.AddWithValue("?id", asset.ID);
221 cmd.Parameters.AddWithValue("?name", asset.Name); 235 cmd.Parameters.AddWithValue("?name", assetName);
222 cmd.Parameters.AddWithValue("?description", asset.Description); 236 cmd.Parameters.AddWithValue("?description", assetDescription);
223 cmd.Parameters.AddWithValue("?assetType", asset.Type); 237 cmd.Parameters.AddWithValue("?assetType", asset.Type);
224 cmd.Parameters.AddWithValue("?local", asset.Local); 238 cmd.Parameters.AddWithValue("?local", asset.Local);
225 cmd.Parameters.AddWithValue("?temporary", asset.Temporary); 239 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);