From 9e37e291b0cb8e88b1cd72d3644aec4159b6f3bd Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Wed, 27 May 2009 17:34:06 +0000
Subject: making TarArchiveReader more resilient when faced with OARs created
by ancient tars.
---
OpenSim/Framework/Serialization/TarArchiveReader.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Framework/Serialization/TarArchiveReader.cs b/OpenSim/Framework/Serialization/TarArchiveReader.cs
index da5703f..1088870 100644
--- a/OpenSim/Framework/Serialization/TarArchiveReader.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveReader.cs
@@ -63,7 +63,11 @@ namespace OpenSim.Framework.Serialization
///
/// Used to trim off null chars
///
- protected char[] m_nullCharArray = new char[] { '\0' };
+ protected static char[] m_nullCharArray = new char[] { '\0' };
+ ///
+ /// Used to trim off space chars
+ ///
+ protected static char[] m_spaceCharArray = new char[] { ' ' };
///
/// Generate a tar reader which reads from the given stream.
@@ -195,7 +199,9 @@ namespace OpenSim.Framework.Serialization
///
public static int ConvertOctalBytesToDecimal(byte[] bytes, int startIndex, int count)
{
- string oString = m_asciiEncoding.GetString(bytes, startIndex, count);
+ // Trim leading white space: ancient tars do that instead
+ // of leading 0s :-( don't ask. really.
+ string oString = m_asciiEncoding.GetString(bytes, startIndex, count).TrimStart(m_spaceCharArray);
int d = 0;
--
cgit v1.1