Don't allow oversized search reply packets

prebuild-update
Melanie Thielker 2010-08-21 17:48:49 +02:00 committed by Melanie
parent ea1df09fa4
commit 954329ec85
1 changed files with 42 additions and 17 deletions

View File

@ -2715,31 +2715,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1]; packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock(); packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
packet.QueryReplies = packet.AgentData.AgentID = AgentId;
new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[ packet.QueryData[0].QueryID = queryID;
data.Length];
DirPlacesReplyPacket.QueryRepliesBlock[] replies =
new DirPlacesReplyPacket.QueryRepliesBlock[0];
DirPlacesReplyPacket.StatusDataBlock[] status =
new DirPlacesReplyPacket.StatusDataBlock[0];
int i = 0;
foreach (DirPlacesReplyData d in data)
{
int idx = replies.Length;
Array.Resize(ref replies, idx + 1);
Array.Resize(ref status, idx + 1);
replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock();
status[idx] = new DirPlacesReplyPacket.StatusDataBlock();
replies[idx].ParcelID = d.parcelID;
replies[idx].Name = Utils.StringToBytes(d.name);
replies[idx].ForSale = d.forSale;
replies[idx].Auction = d.auction;
replies[idx].Dwell = d.dwell;
status[idx].Status = d.Status;
packet.QueryReplies = replies;
packet.StatusData = status;
if (packet.Length >= 1000)
{
OutPacket(packet, ThrottleOutPacketType.Task);
packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply);
packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock();
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
packet.AgentData.AgentID = AgentId; packet.AgentData.AgentID = AgentId;
packet.QueryData[0].QueryID = queryID; packet.QueryData[0].QueryID = queryID;
int i = 0; replies = new DirPlacesReplyPacket.QueryRepliesBlock[0];
foreach (DirPlacesReplyData d in data) status = new DirPlacesReplyPacket.StatusDataBlock[0];
{
packet.QueryReplies[i] = }
new DirPlacesReplyPacket.QueryRepliesBlock();
packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock();
packet.QueryReplies[i].ParcelID = d.parcelID;
packet.QueryReplies[i].Name = Utils.StringToBytes(d.name);
packet.QueryReplies[i].ForSale = d.forSale;
packet.QueryReplies[i].Auction = d.auction;
packet.QueryReplies[i].Dwell = d.dwell;
packet.StatusData[i].Status = d.Status;
i++;
} }
if (replies.Length > 0)
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }