diff options
author | UbitUmarov | 2014-08-08 01:32:16 +0100 |
---|---|---|
committer | UbitUmarov | 2014-08-08 01:32:16 +0100 |
commit | c6cdd597f3ac0165d73a152b23a3abbbceb9a96e (patch) | |
tree | c772724a9a08d548c747bceeff16fbdd157d426a | |
parent | Fix coalesced objects not showing up as "piles" of prims (AVN only bug) (diff) | |
download | opensim-SC-c6cdd597f3ac0165d73a152b23a3abbbceb9a96e.zip opensim-SC-c6cdd597f3ac0165d73a152b23a3abbbceb9a96e.tar.gz opensim-SC-c6cdd597f3ac0165d73a152b23a3abbbceb9a96e.tar.bz2 opensim-SC-c6cdd597f3ac0165d73a152b23a3abbbceb9a96e.tar.xz |
add wearables array size checks on unpack
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 14 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 7 |
2 files changed, 18 insertions, 3 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a34c85f..55e4b40 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -458,7 +458,12 @@ namespace OpenSim.Framework | |||
458 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); | 458 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); |
459 | // DEBUG OFF | 459 | // DEBUG OFF |
460 | m_wearables[wearableId].Clear(); | 460 | m_wearables[wearableId].Clear(); |
461 | for (int i = 0; i < wearable.Count; i++) | 461 | |
462 | int count = wearable.Count; | ||
463 | if (count > AvatarWearable.MAX_WEARABLES) | ||
464 | count = AvatarWearable.MAX_WEARABLES; | ||
465 | |||
466 | for (int i = 0; i < count; i++) | ||
462 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | 467 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); |
463 | } | 468 | } |
464 | 469 | ||
@@ -751,7 +756,12 @@ namespace OpenSim.Framework | |||
751 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) | 756 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) |
752 | { | 757 | { |
753 | OSDArray wears = (OSDArray)(data["wearables"]); | 758 | OSDArray wears = (OSDArray)(data["wearables"]); |
754 | for (int i = 0; i < wears.Count; i++) | 759 | |
760 | int count = wears.Count; | ||
761 | if (count > AvatarWearable.MAX_WEARABLES) | ||
762 | count = AvatarWearable.MAX_WEARABLES; | ||
763 | |||
764 | for (int i = 0; i < count; i++) | ||
755 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); | 765 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); |
756 | } | 766 | } |
757 | else | 767 | else |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 8c32734..967278e 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -657,7 +657,12 @@ namespace OpenSim.Framework | |||
657 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 657 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
658 | { | 658 | { |
659 | OSDArray wears = (OSDArray)(args["wearables"]); | 659 | OSDArray wears = (OSDArray)(args["wearables"]); |
660 | for (int i = 0; i < wears.Count / 2; i++) | 660 | |
661 | int count = wears.Count; | ||
662 | if (count > AvatarWearable.MAX_WEARABLES) | ||
663 | count = AvatarWearable.MAX_WEARABLES; | ||
664 | |||
665 | for (int i = 0; i < count / 2; i++) | ||
661 | { | 666 | { |
662 | AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); | 667 | AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); |
663 | Appearance.SetWearable(i,awear); | 668 | Appearance.SetWearable(i,awear); |