From 83bd85ce7fed09be34df870dd6473c123e592744 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Thu, 29 May 2008 16:21:41 +0000
Subject: * Fix string literal with URL + LLcommand(); * Added 'detected
 around: value' when a x.Y detect occurs to help debug. * Fixed object text is
 too long to store to the database (wikilith)

---
 OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs          |  9 ++++++++-
 OpenSim/Region/Environment/Scenes/SceneObjectPart.cs           | 10 +++++++++-
 .../ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs  | 10 +++++-----
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 47a239a..94d888c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -270,7 +270,14 @@ namespace OpenSim.Region.Environment.Scenes
 
         public string Text
         {
-            get { return m_rootPart.Text; }
+            get {
+                string returnstr = m_rootPart.Text;
+                if (returnstr.Length  > 255)
+                {
+                    returnstr = returnstr.Substring(0, 255);
+                }
+                return returnstr;
+            }
             set { m_rootPart.Text = value; }
         }
 
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 9afffbe..de5da40 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -585,7 +585,15 @@ namespace OpenSim.Region.Environment.Scenes
 
         public string Text
         {
-            get { return m_text; }
+            get
+            {
+                string returnstr = m_text;
+                if (returnstr.Length > 255)
+                {
+                    returnstr = returnstr.Substring(0, 254);
+                }
+                return returnstr;
+            }
             set
             {
                 m_text = value;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index a40b95b..10380f2 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
         // c Style
         private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline);
         // c# one liners
-        private Regex nonCommentFwsl = new Regex("\"[a-zA-Z0-9.,:/ ]+//[^\"]+(" + @"[\\" + "\"]+)?[\"](\\s+)?;", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
+        private Regex nonCommentFwsl = new Regex("\"[a-zA-Z0-9.,:/\\n ]+//[^\"+]+([\\\\\\\"+]+)?(\\s+)?[\"+](\\s+)?(;)?", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
         private Regex conelinecomments = new Regex(@"[^:].?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline);
         // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"])
 
@@ -121,10 +121,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
             // ignores alpha.x alpha.y, alpha.z for refering to vector components
             Match SecurityM;
 
-            // BROKEN: this check is very wrong.  It block's any url in strings.
-            SecurityM = Regex.Match(checkscript, @"(?:[a-zA-Z])\.(?:[a-wA-Z]|[a-zA-Z][a-zA-Z])", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
-            if (SecurityM.Success)
-               throw new Exception("CS0103: 'The . symbol cannot be used in LSL except in float values or vector components'");
+            
+            SecurityM = Regex.Match(checkscript, @"([a-zA-Z])\.(?:[a-wA-Z]|[a-zA-Z][a-zA-Z])", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
+            if (SecurityM.Success) 
+               throw new Exception("CS0103: 'The . symbol cannot be used in LSL except in float values or vector components'.  Detected around: " + SecurityM.Captures[0].Value);
 
             SecurityM = Regex.Match(checkscript, @"typeof\s", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
             if (SecurityM.Success)
-- 
cgit v1.1