Ver código fonte

also check the url on llHTTPRequest before doing anything with garbage

UbitUmarov 3 anos atrás
pai
commit
874808522f

+ 18 - 2
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs

@@ -13572,7 +13572,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
         public LSL_Integer llModPow(int a, int b, int c)
         {
             m_host.AddScriptLPS(1);
-            Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out long tmp);
+            Math.DivRem((long)Math.Pow(a, b), c, out long tmp);
             ScriptSleep(m_sleepMsOnModPow);
             return (int)tmp;
         }
@@ -14259,11 +14259,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
             m_host.AddScriptLPS(1);
             IHttpRequestModule httpScriptMod = m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
             if(httpScriptMod == null)
-                return "";
+                return string.Empty;
 
             if(!httpScriptMod.CheckThrottle(m_host.LocalId, m_host.OwnerID))
                 return ScriptBaseClass.NULL_KEY;
 
+            try
+            {
+                Uri m_checkuri = new Uri(url);
+                if (m_checkuri.Scheme != Uri.UriSchemeHttp && m_checkuri.Scheme != Uri.UriSchemeHttps)
+                {
+                    Error("llHTTPRequest", "Invalid url schema");
+                    ScriptSleep(200);
+                    return string.Empty;
+                }
+            }
+            catch
+            {
+                Error("llHTTPRequest", "Invalid url");
+                ScriptSleep(200);
+                return string.Empty;
+            }
             List<string> param = new List<string>();
             bool  ok;
             int nCustomHeaders = 0;