[FIX] fixed doctor buffer overflow

This commit is contained in:
Sem van der Hoeven
2020-10-28 13:23:20 +01:00
parent 5f2e325cb1
commit 1c7f9cf70a
2 changed files with 3 additions and 3 deletions

View File

@@ -129,14 +129,13 @@ namespace DoctorApp.Utils
{
MainViewModel.TransferDataToClientBPM(payloadbytes);
}
Array.Copy(totalBuffer, expectedMessageLength, totalBuffer, 0, (totalBufferReceived - expectedMessageLength)); //maybe unsafe idk
totalBufferReceived -= expectedMessageLength;
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
}
if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead) || !this.client.Connected)
return;
ar.AsyncWaitHandle.WaitOne();
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
}