From e36e416637f35de76079989b59eb37fc4bb091de Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 6 Aug 2014 19:02:15 +0300 Subject: Fixed crash when using Allowed/Denied Viewers, and the viewer's name is shorter than one of the test strings This fixes http://opensimulator.org/mantis/view.php?id=7294 --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8268235..082eea5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3525,7 +3525,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (string viewer in m_AllowedViewers) { - if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower()) + if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower()) { ViewerDenied = false; break; @@ -3542,7 +3542,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (string viewer in m_BannedViewers) { - if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower()) + if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower()) { ViewerDenied = true; break; -- cgit v1.1