Closed RayKoopa closed 3 years ago
Small issue, but shouldn't this line...
if (!reader.TryReadBigEndian(out int length) || input.Length < length)
... be ...
if (!reader.TryReadBigEndian(out int length) || input.Length - sizeof(int) < length)
...?
My understanding was:
input
length
payload
input.Length
Good catch! Do you want to send a pull request? You should actually be able to use reader.Remaining.
I did not know about reader.Remaining, good to know! I will submit a PR with it tomorrow.
reader.Remaining
Small issue, but shouldn't this line...
... be ...
...?
My understanding was:
input
includes all message bytes, including the 4-bytelength
prefix, and the variable lengthpayload
.payload
bytes are available.length
should be subtracted frominput.Length
.