From b6c3592411a0f2b64f3ebd80482fe1fe8cce0097 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 10 Nov 2015 15:08:08 +0000 Subject: [PATCH] fix/add lldialog and llTextBox message size error checks, aborting if error as spec. (we can change this to silent truncate and execute the larger ones since llUdp now does it. But doing as spec now) --- .../Shared/Api/Implementation/LSL_Api.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 34a72c95bf..8154c4f6f6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5077,9 +5077,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Error("llTextBox", "Empty message"); } - else if (message.Length > 512) + else if (Encoding.UTF8.GetByteCount(message) > 512) { - Error("llTextBox", "Message more than 512 characters"); + Error("llTextBox", "Message longer than 512 bytes"); } else { @@ -7908,6 +7908,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } + if (message == string.Empty) + { + Error("llDialog", "Empty message"); + } + else if (Encoding.UTF8.GetByteCount(message) > 512) + { + Error("llDialog", "Message longer than 512 bytes"); + } + string[] buts = new string[length]; for (int i = 0; i < length; i++) {