diff options
author | Melanie | 2012-11-17 02:58:14 +0000 |
---|---|---|
committer | Melanie | 2012-11-17 02:58:14 +0000 |
commit | 7ad082f7c39ba82adeae3c25ca0befcf983c879d (patch) | |
tree | 0e3c488c65ef22b53e4536dd07f46c1467b58f78 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Prevent a buffer overflow in asset receiving (diff) | |
download | opensim-SC-7ad082f7c39ba82adeae3c25ca0befcf983c879d.zip opensim-SC-7ad082f7c39ba82adeae3c25ca0befcf983c879d.tar.gz opensim-SC-7ad082f7c39ba82adeae3c25ca0befcf983c879d.tar.bz2 opensim-SC-7ad082f7c39ba82adeae3c25ca0befcf983c879d.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index f6dd5af..0aa4693 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -136,18 +136,27 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
136 | 136 | ||
137 | if (XferID == xferID) | 137 | if (XferID == xferID) |
138 | { | 138 | { |
139 | if (m_asset.Data.Length > 1) | 139 | lock (this) |
140 | { | 140 | { |
141 | byte[] destinationArray = new byte[m_asset.Data.Length + data.Length]; | 141 | int assetLength = m_asset.Data.Length; |
142 | Array.Copy(m_asset.Data, 0, destinationArray, 0, m_asset.Data.Length); | 142 | int dataLength = data.Length; |
143 | Array.Copy(data, 0, destinationArray, m_asset.Data.Length, data.Length); | 143 | |
144 | m_asset.Data = destinationArray; | 144 | if (m_asset.Data.Length > 1) |
145 | } | 145 | { |
146 | else | 146 | byte[] destinationArray = new byte[assetLength + dataLength]; |
147 | { | 147 | Array.Copy(m_asset.Data, 0, destinationArray, 0, assetLength); |
148 | byte[] buffer2 = new byte[data.Length - 4]; | 148 | Array.Copy(data, 0, destinationArray, assetLength, dataLength); |
149 | Array.Copy(data, 4, buffer2, 0, data.Length - 4); | 149 | m_asset.Data = destinationArray; |
150 | m_asset.Data = buffer2; | 150 | } |
151 | else | ||
152 | { | ||
153 | if (dataLength > 4) | ||
154 | { | ||
155 | byte[] buffer2 = new byte[dataLength - 4]; | ||
156 | Array.Copy(data, 4, buffer2, 0, dataLength - 4); | ||
157 | m_asset.Data = buffer2; | ||
158 | } | ||
159 | } | ||
151 | } | 160 | } |
152 | 161 | ||
153 | ourClient.SendConfirmXfer(xferID, packetID); | 162 | ourClient.SendConfirmXfer(xferID, packetID); |