aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorAdam Frisby2007-11-24 10:05:42 +0000
committerAdam Frisby2007-11-24 10:05:42 +0000
commit39a3784b43a891b307963e5545bcf731a54e01e0 (patch)
tree585706f448c154c3f8a3d9d3bf2ec49f058775ea /OpenSim
parent* Changed reference to NullReferenceException to System.NullReferenceExceptio... (diff)
downloadopensim-SC_OLD-39a3784b43a891b307963e5545bcf731a54e01e0.zip
opensim-SC_OLD-39a3784b43a891b307963e5545bcf731a54e01e0.tar.gz
opensim-SC_OLD-39a3784b43a891b307963e5545bcf731a54e01e0.tar.bz2
opensim-SC_OLD-39a3784b43a891b307963e5545bcf731a54e01e0.tar.xz
* Added some bounds checks to the sendLandUpdate packet to deal with agents coming in from foreign regions.
* Updated bounds-check of getLandObject to check for >= 256 rather than > 256.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index dfeb36a..dd35a26 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -209,7 +209,7 @@ namespace OpenSim.Region.Environment.LandManagement
209 int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0))); 209 int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0)));
210 int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0))); 210 int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0)));
211 211
212 if (x > 63 || y > 63 || x < 0 || y < 0) 212 if (x >= 64 || y >= 64 || x < 0 || y < 0)
213 { 213 {
214 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 214 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
215 } 215 }
@@ -222,7 +222,7 @@ namespace OpenSim.Region.Environment.LandManagement
222 222
223 public Land getLandObject(int x, int y) 223 public Land getLandObject(int x, int y)
224 { 224 {
225 if (x > 256 || y > 256 || x < 0 || y < 0) 225 if (x >= 256 || y >= 256 || x < 0 || y < 0)
226 { 226 {
227 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 227 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
228 } 228 }
@@ -535,8 +535,8 @@ namespace OpenSim.Region.Environment.LandManagement
535 535
536 public void sendLandUpdate(ScenePresence avatar) 536 public void sendLandUpdate(ScenePresence avatar)
537 { 537 {
538 Land over = getLandObject((int) Math.Round(avatar.AbsolutePosition.X), 538 Land over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
539 (int) Math.Round(avatar.AbsolutePosition.Y)); 539 (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
540 540
541 if (over != null) 541 if (over != null)
542 { 542 {