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,32 +2715,57 @@ 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 =
new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[
data.Length];
packet.AgentData.AgentID = AgentId; packet.AgentData.AgentID = AgentId;
packet.QueryData[0].QueryID = queryID; packet.QueryData[0].QueryID = queryID;
DirPlacesReplyPacket.QueryRepliesBlock[] replies =
new DirPlacesReplyPacket.QueryRepliesBlock[0];
DirPlacesReplyPacket.StatusDataBlock[] status =
new DirPlacesReplyPacket.StatusDataBlock[0];
int i = 0; int i = 0;
foreach (DirPlacesReplyData d in data) foreach (DirPlacesReplyData d in data)
{ {
packet.QueryReplies[i] = int idx = replies.Length;
new DirPlacesReplyPacket.QueryRepliesBlock(); Array.Resize(ref replies, idx + 1);
packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock(); Array.Resize(ref status, idx + 1);
packet.QueryReplies[i].ParcelID = d.parcelID;
packet.QueryReplies[i].Name = Utils.StringToBytes(d.name); replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock();
packet.QueryReplies[i].ForSale = d.forSale; status[idx] = new DirPlacesReplyPacket.StatusDataBlock();
packet.QueryReplies[i].Auction = d.auction; replies[idx].ParcelID = d.parcelID;
packet.QueryReplies[i].Dwell = d.dwell; replies[idx].Name = Utils.StringToBytes(d.name);
packet.StatusData[i].Status = d.Status; replies[idx].ForSale = d.forSale;
i++; 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.QueryData[0].QueryID = queryID;
replies = new DirPlacesReplyPacket.QueryRepliesBlock[0];
status = new DirPlacesReplyPacket.StatusDataBlock[0];
}
} }
OutPacket(packet, ThrottleOutPacketType.Task); if (replies.Length > 0)
OutPacket(packet, ThrottleOutPacketType.Task);
} }
public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)