diff options
author | idb | 2009-03-07 14:16:26 +0000 |
---|---|---|
committer | idb | 2009-03-07 14:16:26 +0000 |
commit | aab1601642ef6c1b028fc3160e809732ab4d1769 (patch) | |
tree | 7a2321222bc2279dcc689967b22c16b70cb8eef5 /OpenSim/Region | |
parent | Added the ability to set User-Agent in llHTTPRequest. No new default value ha... (diff) | |
download | opensim-SC-aab1601642ef6c1b028fc3160e809732ab4d1769.zip opensim-SC-aab1601642ef6c1b028fc3160e809732ab4d1769.tar.gz opensim-SC-aab1601642ef6c1b028fc3160e809732ab4d1769.tar.bz2 opensim-SC-aab1601642ef6c1b028fc3160e809732ab4d1769.tar.xz |
Limit the message length from llInstantMessage to 1024 characters http://wiki.secondlife.com/wiki/LlInstantMessage
Also truncate messages that may exceed the limit set by the packet size. The limit in OpenMetaverse is 1100 bytes including a zero byte terminator.
Fixes Mantis #3244
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6e1bd82..ac427d7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -1206,7 +1206,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1206 | msg.MessageBlock.RegionID = UUID.Zero; | 1206 | msg.MessageBlock.RegionID = UUID.Zero; |
1207 | msg.MessageBlock.Timestamp = timeStamp; | 1207 | msg.MessageBlock.Timestamp = timeStamp; |
1208 | msg.MessageBlock.ToAgentID = toAgent; | 1208 | msg.MessageBlock.ToAgentID = toAgent; |
1209 | msg.MessageBlock.Message = Utils.StringToBytes(message); | 1209 | // Cap the message length at 1099. There is a limit in ImprovedInstantMessagePacket |
1210 | // the limit is 1100 but a 0 byte gets added to mark the end of the string | ||
1211 | if (message != null && message.Length > 1099) | ||
1212 | msg.MessageBlock.Message = Utils.StringToBytes(message.Substring(0, 1099)); | ||
1213 | else | ||
1214 | msg.MessageBlock.Message = Utils.StringToBytes(message); | ||
1210 | msg.MessageBlock.BinaryBucket = binaryBucket; | 1215 | msg.MessageBlock.BinaryBucket = binaryBucket; |
1211 | 1216 | ||
1212 | if (message.StartsWith("[grouptest]")) | 1217 | if (message.StartsWith("[grouptest]")) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6bb0fe9..69d9c38 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2717,7 +2717,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2717 | //{ | 2717 | //{ |
2718 | // msg.fromAgentName = "(hippos)";// Added for posterity. This means that we can't figure out who sent it | 2718 | // msg.fromAgentName = "(hippos)";// Added for posterity. This means that we can't figure out who sent it |
2719 | //} | 2719 | //} |
2720 | msg.message = message; | 2720 | // Cap the message length at 1024. |
2721 | if (message != null && message.Length > 1024) | ||
2722 | msg.message = message.Substring(0, 1024); | ||
2723 | else | ||
2724 | msg.message = message; | ||
2721 | msg.dialog = (byte)19; // messgage from script ??? // dialog; | 2725 | msg.dialog = (byte)19; // messgage from script ??? // dialog; |
2722 | msg.fromGroup = false;// fromGroup; | 2726 | msg.fromGroup = false;// fromGroup; |
2723 | msg.offline = (byte)0; //offline; | 2727 | msg.offline = (byte)0; //offline; |