From b2de81ebac9d07e8377814e47e7e261612e974bb Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Tue, 17 Mar 2009 07:03:53 +0000 Subject: From: Christopher Yeoh Attached is a patch which enabled through an OpenSim.ini option the ability to read long notecard lines. Currently although the data is read from the notecard it is truncated at 255 characters (same as for the LL servers. This patch allows the setting of that limit to a different value. ; Maximum length of notecard line read ; Increasing this to large values potentially opens ; up the system to malicious scripters ; NotecardLineReadCharsMax = 255 this allows for save/restore functionality using notecards without having to worry about very short line length limits. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1ede395..f809ef2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -82,6 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private bool m_waitingForScriptAnswer=false; private bool m_automaticLinkPermission=false; private IMessageTransferModule m_TransferModule = null; + private int m_notecardLineReadCharsMax = 255; //private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -100,6 +101,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); m_automaticLinkPermission = m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); + m_notecardLineReadCharsMax = + m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); + if (m_notecardLineReadCharsMax > 65535) + m_notecardLineReadCharsMax = 65535; m_TransferModule = m_ScriptEngine.World.RequestModuleInterface(); @@ -9133,7 +9138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { AsyncCommands. DataserverPlugin.DataserverReply(item.AssetID.ToString(), - NotecardCache.GetLine(item.AssetID, line)); + NotecardCache.GetLine(item.AssetID, line, m_notecardLineReadCharsMax)); // ScriptSleep(100); return tid.ToString(); } @@ -9147,7 +9152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api NotecardCache.Cache(id, data); AsyncCommands. DataserverPlugin.DataserverReply(id.ToString(), - NotecardCache.GetLine(id, line)); + NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); }); // ScriptSleep(100); @@ -9291,7 +9296,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public static string GetLine(UUID assetID, int line) + public static string GetLine(UUID assetID, int line, int maxLength) { if (line < 0) return ""; @@ -9309,8 +9314,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return "\n\n\n"; data = m_Notecards[assetID].text[line]; - if (data.Length > 255) - data = data.Substring(0, 255); + if (data.Length > maxLength) + data = data.Substring(0, maxLength); return data; } -- cgit v1.1