From acf7206f4ba31c7068d9d235c5bd36bb039eb72d Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 2 Aug 2009 19:30:25 +0000 Subject: [PATCH] Thank you kindly, dslake, for a patch that: The region dearchive module assumes extra null bytes will be appended to the end of every OAR file. This may be due to the block nature of storage but it seems like an unsafe assumption. When streaming region archives over a network or through a memory stream, no additional null bytes are added to the end and this an exception. --- OpenSim/Framework/Serialization/TarArchiveReader.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Framework/Serialization/TarArchiveReader.cs b/OpenSim/Framework/Serialization/TarArchiveReader.cs index 694ea70e8f..77c29f8cac 100644 --- a/OpenSim/Framework/Serialization/TarArchiveReader.cs +++ b/OpenSim/Framework/Serialization/TarArchiveReader.cs @@ -105,6 +105,10 @@ namespace OpenSim.Framework.Serialization { byte[] header = m_br.ReadBytes(512); + // If there are no more bytes in the stream, return null header + if (header.Length == 0) + return null; + // If we've reached the end of the archive we'll be in null block territory, which means // the next byte will be 0 if (header[0] == 0)