From 8f8e9d4cd4a6cc674162517ed055a00c6beae080 Mon Sep 17 00:00:00 2001 From: White Date: Tue, 7 Jul 2015 22:55:14 +0930 Subject: [PATCH] Fixed an issue in NetGetData where e.Length - 1 would be -1 --- TShockAPI/TShock.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b3cdff46..9258ad60 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1274,6 +1274,11 @@ namespace TShockAPI return; } + int length = e.Length - 1; + if (length < 0) + { + length = 0; + } using (var data = new MemoryStream(e.Msg.readBuffer, e.Index, e.Length - 1)) { // Exceptions are already handled