Fixed channel count exceed checks
The check aborted on CHANNEL_MAX_COUNT - 1 instead of correctly at CHANNEL_MAX_COUNT
This commit is contained in:
parent
ae0fb64656
commit
3e4c274cc9
@ -662,12 +662,11 @@ void freerdp_channels_close(rdpChannels* channels, freerdp* instance)
|
|||||||
for (index = 0; index < channels->openDataCount; index++)
|
for (index = 0; index < channels->openDataCount; index++)
|
||||||
{
|
{
|
||||||
pChannelOpenData = &channels->openDataList[index];
|
pChannelOpenData = &channels->openDataList[index];
|
||||||
|
|
||||||
freerdp_channel_remove_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle);
|
freerdp_channel_remove_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle);
|
||||||
|
|
||||||
if (channels->openHandles)
|
if (channels->openHandles)
|
||||||
HashTable_Remove(channels->openHandles,
|
HashTable_Remove(channels->openHandles,
|
||||||
(void*)(UINT_PTR)pChannelOpenData->OpenHandle);
|
(void*)(UINT_PTR)pChannelOpenData->OpenHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
channels->openDataCount = 0;
|
channels->openDataCount = 0;
|
||||||
@ -702,7 +701,7 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(LPVOID lpUserParam, LPVOID cl
|
|||||||
if (!channels->can_call_init)
|
if (!channels->can_call_init)
|
||||||
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
|
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
|
||||||
|
|
||||||
if ((channels->openDataCount + channelCount) >= CHANNEL_MAX_COUNT)
|
if ((channels->openDataCount + channelCount) > CHANNEL_MAX_COUNT)
|
||||||
return CHANNEL_RC_TOO_MANY_CHANNELS;
|
return CHANNEL_RC_TOO_MANY_CHANNELS;
|
||||||
|
|
||||||
if (!pChannel)
|
if (!pChannel)
|
||||||
@ -790,7 +789,7 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle,
|
|||||||
if (!channels->can_call_init)
|
if (!channels->can_call_init)
|
||||||
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
|
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
|
||||||
|
|
||||||
if (channels->openDataCount + channelCount >= CHANNEL_MAX_COUNT)
|
if (channels->openDataCount + channelCount > CHANNEL_MAX_COUNT)
|
||||||
return CHANNEL_RC_TOO_MANY_CHANNELS;
|
return CHANNEL_RC_TOO_MANY_CHANNELS;
|
||||||
|
|
||||||
if (!pChannel)
|
if (!pChannel)
|
||||||
@ -1103,7 +1102,7 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings,
|
|||||||
CHANNEL_ENTRY_POINTS_FREERDP EntryPoints;
|
CHANNEL_ENTRY_POINTS_FREERDP EntryPoints;
|
||||||
CHANNEL_CLIENT_DATA* pChannelClientData;
|
CHANNEL_CLIENT_DATA* pChannelClientData;
|
||||||
|
|
||||||
if (channels->clientDataCount + 1 >= CHANNEL_MAX_COUNT)
|
if (channels->clientDataCount + 1 > CHANNEL_MAX_COUNT)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "error: too many channels");
|
WLog_ERR(TAG, "error: too many channels");
|
||||||
return 1;
|
return 1;
|
||||||
@ -1156,7 +1155,7 @@ int freerdp_channels_client_load_ex(rdpChannels* channels, rdpSettings* settings
|
|||||||
CHANNEL_INIT_DATA* pChannelInitData = NULL;
|
CHANNEL_INIT_DATA* pChannelInitData = NULL;
|
||||||
CHANNEL_CLIENT_DATA* pChannelClientData = NULL;
|
CHANNEL_CLIENT_DATA* pChannelClientData = NULL;
|
||||||
|
|
||||||
if (channels->clientDataCount + 1 >= CHANNEL_MAX_COUNT)
|
if (channels->clientDataCount + 1 > CHANNEL_MAX_COUNT)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "error: too many channels");
|
WLog_ERR(TAG, "error: too many channels");
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user