mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-02-26 13:31:17 +03:00
Crash fix in ConnectionManager.Receive due to bad pointer
This commit is contained in:
parent
8057413ea3
commit
47b9aca324
@ -110,14 +110,14 @@ namespace Steamworks
|
|||||||
|
|
||||||
public unsafe int Receive( int bufferSize = 32, bool receiveToEnd = true )
|
public unsafe int Receive( int bufferSize = 32, bool receiveToEnd = true )
|
||||||
{
|
{
|
||||||
if ( bufferSize > 256 ) throw new ArgumentOutOfRangeException( nameof( bufferSize ) );
|
if ( bufferSize < 1 || bufferSize > 256 ) throw new ArgumentOutOfRangeException( nameof( bufferSize ) );
|
||||||
|
|
||||||
int totalProcessed = 0;
|
int totalProcessed = 0;
|
||||||
NetMsg** messageBuffer = stackalloc NetMsg*[bufferSize];
|
NetMsg** messageBuffer = stackalloc NetMsg*[bufferSize];
|
||||||
|
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
int processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnConnection( Connection, new IntPtr( &messageBuffer ), bufferSize );
|
int processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnConnection( Connection, new IntPtr( &messageBuffer[0] ), bufferSize );
|
||||||
totalProcessed += processed;
|
totalProcessed += processed;
|
||||||
|
|
||||||
for ( int i = 0; i < processed; i++ )
|
for ( int i = 0; i < processed; i++ )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user