diff options
author | Justin Clark-Casey (justincc) | 2011-09-13 17:13:42 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-13 17:13:42 +0100 |
commit | 306af9934aac2aaf7fe9baa156b3cc57ff3f3f56 (patch) | |
tree | 20919d561f08703e0cb5c59991b2bc59bc99e7b3 | |
parent | eliminate redundant SP.m_regionInfo since it always has the scene. (diff) | |
download | opensim-SC_OLD-306af9934aac2aaf7fe9baa156b3cc57ff3f3f56.zip opensim-SC_OLD-306af9934aac2aaf7fe9baa156b3cc57ff3f3f56.tar.gz opensim-SC_OLD-306af9934aac2aaf7fe9baa156b3cc57ff3f3f56.tar.bz2 opensim-SC_OLD-306af9934aac2aaf7fe9baa156b3cc57ff3f3f56.tar.xz |
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
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 |
2 files changed, 43 insertions, 3 deletions
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 | |||
1372 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 1372 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | /// <summary> | ||
1376 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. | ||
1377 | /// </summary> | ||
1378 | /// <param name="str"> | ||
1379 | /// If null or empty, then an bytes[0] is returned. | ||
1380 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1381 | /// </param> | ||
1382 | /// <param name="args"> | ||
1383 | /// Arguments to substitute into the string via the {} mechanism. | ||
1384 | /// </param> | ||
1385 | /// <returns></returns> | ||
1375 | public static byte[] StringToBytes256(string str, params object[] args) | 1386 | public static byte[] StringToBytes256(string str, params object[] args) |
1376 | { | 1387 | { |
1377 | return StringToBytes256(string.Format(str, args)); | 1388 | return StringToBytes256(string.Format(str, args)); |
1378 | } | 1389 | } |
1379 | 1390 | ||
1391 | /// <summary> | ||
1392 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. | ||
1393 | /// </summary> | ||
1394 | /// <param name="str"> | ||
1395 | /// If null or empty, then an bytes[0] is returned. | ||
1396 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1397 | /// </param> | ||
1398 | /// <returns></returns> | ||
1380 | public static byte[] StringToBytes256(string str) | 1399 | public static byte[] StringToBytes256(string str) |
1381 | { | 1400 | { |
1382 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1401 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
@@ -1395,11 +1414,30 @@ namespace OpenSim.Framework | |||
1395 | return data; | 1414 | return data; |
1396 | } | 1415 | } |
1397 | 1416 | ||
1417 | /// <summary> | ||
1418 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary. | ||
1419 | /// </summary> | ||
1420 | /// <param name="str"> | ||
1421 | /// If null or empty, then an bytes[0] is returned. | ||
1422 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1423 | /// </param> | ||
1424 | /// <param name="args"> | ||
1425 | /// Arguments to substitute into the string via the {} mechanism. | ||
1426 | /// </param> | ||
1427 | /// <returns></returns> | ||
1398 | public static byte[] StringToBytes1024(string str, params object[] args) | 1428 | public static byte[] StringToBytes1024(string str, params object[] args) |
1399 | { | 1429 | { |
1400 | return StringToBytes1024(string.Format(str, args)); | 1430 | return StringToBytes1024(string.Format(str, args)); |
1401 | } | 1431 | } |
1402 | 1432 | ||
1433 | /// <summary> | ||
1434 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary. | ||
1435 | /// </summary> | ||
1436 | /// <param name="str"> | ||
1437 | /// If null or empty, then an bytes[0] is returned. | ||
1438 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1439 | /// </param> | ||
1440 | /// <returns></returns> | ||
1403 | public static byte[] StringToBytes1024(string str) | 1441 | public static byte[] StringToBytes1024(string str) |
1404 | { | 1442 | { |
1405 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1443 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e0bc891..a0a2624 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1579,7 +1579,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1579 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1579 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1580 | msg.Position = Vector3.Zero; | 1580 | msg.Position = Vector3.Zero; |
1581 | msg.RegionID = RegionInfo.RegionID.Guid; | 1581 | msg.RegionID = RegionInfo.RegionID.Guid; |
1582 | msg.binaryBucket = new byte[0]; | 1582 | |
1583 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. | ||
1584 | msg.binaryBucket = Util.StringToBytes256("\0"); | ||
1583 | if (ret.Value.count > 1) | 1585 | if (ret.Value.count > 1) |
1584 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | 1586 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); |
1585 | else | 1587 | else |