From 306af9934aac2aaf7fe9baa156b3cc57ff3f3f56 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 17:13:42 +0100
Subject: In an object return message, send a null-terminated empty string in
binary bucket to prevent a viewer 3 crash.
This is the message sent to the client when the object is returned.
We were sending byte[0] in the binary bucket. This didn't kill viewer 1 but did terminate viewer 3 (don't know about viewer 2).
So sending "\0" instead.
This is to address http://opensimulator.org/mantis/view.php?id=5683
---
OpenSim/Framework/Util.cs | 42 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 745da17..c4fc643 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1372,11 +1372,30 @@ namespace OpenSim.Framework
return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
}
+ ///
+ /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary.
+ ///
+ ///
+ /// If null or empty, then an bytes[0] is returned.
+ /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0]
+ ///
+ ///
+ /// Arguments to substitute into the string via the {} mechanism.
+ ///
+ ///
public static byte[] StringToBytes256(string str, params object[] args)
{
return StringToBytes256(string.Format(str, args));
}
-
+
+ ///
+ /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary.
+ ///
+ ///
+ /// If null or empty, then an bytes[0] is returned.
+ /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0]
+ ///
+ ///
public static byte[] StringToBytes256(string str)
{
if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; }
@@ -1395,11 +1414,30 @@ namespace OpenSim.Framework
return data;
}
+ ///
+ /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary.
+ ///
+ ///
+ /// If null or empty, then an bytes[0] is returned.
+ /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0]
+ ///
+ ///
+ /// Arguments to substitute into the string via the {} mechanism.
+ ///
+ ///
public static byte[] StringToBytes1024(string str, params object[] args)
{
return StringToBytes1024(string.Format(str, args));
}
-
+
+ ///
+ /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary.
+ ///
+ ///
+ /// If null or empty, then an bytes[0] is returned.
+ /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0]
+ ///
+ ///
public static byte[] StringToBytes1024(string str)
{
if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; }
--
cgit v1.1