* Fix probable cause of one of the bugs seen in the osgrid office hours today

* If a text string is too long we actually need to truncate to 254 chars rather than 255, since the Helpers.StringToField conversion will stick a \0 on the end
0.6.0-stable
Justin Clarke Casey 2008-08-05 20:34:34 +00:00
parent 9e6fadddcc
commit 6b1a5c33af
1 changed files with 4 additions and 3 deletions

View File

@ -2287,10 +2287,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outPacket.ObjectData[0].FullID = objectID; outPacket.ObjectData[0].FullID = objectID;
outPacket.ObjectData[0].OwnerID = ownerID; outPacket.ObjectData[0].OwnerID = ownerID;
// Anything more than 255 will cause libsecondlife to barf // Anything more than 254 will cause libsecondlife to barf
if (text.Length > 255) // (libsl 1550) adds an \0 on the Helpers.StringToField conversion if it isn't present
if (text.Length > 254)
{ {
text = text.Remove(255); text = text.Remove(254);
} }
outPacket.ObjectData[0].Text = Helpers.StringToField(text); outPacket.ObjectData[0].Text = Helpers.StringToField(text);