From 2f39b2e07403ccb707a17918c5d5984cedebedb8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 27 Aug 2024 16:58:12 -0600 Subject: [PATCH] lsteamclient: Handle error result in networking_message_pool_receive_(). CW-Bug-Id: #24177 --- lsteamclient/steam_networking_manual.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lsteamclient/steam_networking_manual.c b/lsteamclient/steam_networking_manual.c index 83ada55549..37636a4d09 100644 --- a/lsteamclient/steam_networking_manual.c +++ b/lsteamclient/steam_networking_manual.c @@ -88,6 +88,8 @@ static BOOL networking_message_pool_receive_144( int32_t capacity, int32_t count struct networking_message_pool *pool = CONTAINING_RECORD( messages[0], struct networking_message, w_msg_144 )->pool; int32_t i; + if (count < 0) count = 0; + for (i = count; i < capacity; i++) { messages[i]->m_pfnRelease( messages[i] ); @@ -155,11 +157,13 @@ static BOOL networking_message_pool_create_147( uint32_t count, w_SteamNetworkin return TRUE; } -static BOOL networking_message_pool_receive_147( uint32_t capacity, uint32_t count, w_SteamNetworkingMessage_t_147 **messages ) +static BOOL networking_message_pool_receive_147( uint32_t capacity, int32_t count, w_SteamNetworkingMessage_t_147 **messages ) { struct networking_message_pool *pool = CONTAINING_RECORD( messages[0], struct networking_message, w_msg_147 )->pool; uint32_t i; + if (count < 0) count = 0; + for (i = count; i < capacity; i++) { messages[i]->m_pfnRelease( messages[i] ); @@ -227,11 +231,13 @@ static BOOL networking_message_pool_create_153a( uint32_t count, w_SteamNetworki return TRUE; } -static BOOL networking_message_pool_receive_153a( uint32_t capacity, uint32_t count, w_SteamNetworkingMessage_t_153a **messages ) +static BOOL networking_message_pool_receive_153a( uint32_t capacity, int32_t count, w_SteamNetworkingMessage_t_153a **messages ) { struct networking_message_pool *pool = CONTAINING_RECORD( messages[0], struct networking_message, w_msg_153a )->pool; uint32_t i; + if (count < 0) count = 0; + for (i = count; i < capacity; i++) { messages[i]->m_pfnRelease( messages[i] );