add limites checks on wearables size, revert to max 15 for

compatibility/testing
avinationmerge
UbitUmarov 2014-08-07 23:29:31 +01:00
parent 7486684436
commit 4ae0bb7df1
3 changed files with 19 additions and 6 deletions

View File

@ -462,7 +462,10 @@ namespace OpenSim.Framework
// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
// DEBUG OFF
m_wearables[wearableId].Clear();
for (int i = 0; i < wearable.Count; i++)
int count = wearable.Count;
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count; i++)
m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
}
@ -755,7 +758,12 @@ namespace OpenSim.Framework
if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
{
OSDArray wears = (OSDArray)(data["wearables"]);
for (int i = 0; i < wears.Count; i++)
int count = wears.Count;
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count; i++)
m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
}
else

View File

@ -67,10 +67,10 @@ namespace OpenSim.Framework
public static readonly int ALPHA = 13;
public static readonly int TATTOO = 14;
public static readonly int PHYSICS = 15;
// public static readonly int PHYSICS = 15;
public static readonly int MAX_WEARABLES = 16;
// public static readonly int MAX_WEARABLES = 15;
// public static readonly int MAX_WEARABLES = 16;
public static readonly int MAX_WEARABLES = 15;
public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");

View File

@ -665,7 +665,12 @@ namespace OpenSim.Framework
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
{
OSDArray wears = (OSDArray)(args["wearables"]);
for (int i = 0; i < wears.Count / 2; i++)
int count = wears.Count;
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count / 2; i++)
{
AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
Appearance.SetWearable(i,awear);