mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkReader.ReadArray: use .Remaining
This commit is contained in:
parent
451cd26b47
commit
c9642dbbb2
@ -261,7 +261,7 @@ public static T[] ReadArray<T>(this NetworkReader reader)
|
||||
// this assumes that a reader for T reads at least 1 bytes
|
||||
// we can't know the exact size of T because it could have a user created reader
|
||||
// NOTE: don't add to length as it could overflow if value is int.max
|
||||
if (length > reader.Capacity - reader.Position)
|
||||
if (length > reader.Remaining)
|
||||
{
|
||||
throw new EndOfStreamException($"Received array that is too large: {length}");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user