libfreerdp-core: fix server-side receiving of X224 disconnect TPDU

This commit is contained in:
Marc-André Moreau 2014-09-20 20:19:59 -04:00
parent 86c7f46b76
commit 6cb4b59426

View File

@ -275,18 +275,45 @@ wStream* rdp_message_channel_pdu_init(rdpRdp* rdp)
BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
{
BYTE li;
BYTE byte;
BYTE code;
BYTE choice;
UINT16 initiator;
enum DomainMCSPDU MCSPDU;
enum DomainMCSPDU domainMCSPDU;
MCSPDU = (rdp->settings->ServerMode) ? DomainMCSPDU_SendDataRequest : DomainMCSPDU_SendDataIndication;
if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, length))
*length = tpkt_read_header(s);
if (!tpdu_read_header(s, &code, &li))
return FALSE;
if (code != X224_TPDU_DATA)
{
if (MCSPDU != DomainMCSPDU_DisconnectProviderUltimatum)
if (code == X224_TPDU_DISCONNECT_REQUEST)
{
rdp->disconnect = TRUE;
return TRUE;
}
return FALSE;
}
if (!per_read_choice(s, &choice))
return FALSE;
domainMCSPDU = (enum DomainMCSPDU) (choice >> 2);
if (domainMCSPDU != MCSPDU)
{
if (domainMCSPDU != DomainMCSPDU_DisconnectProviderUltimatum)
return FALSE;
}
MCSPDU = domainMCSPDU;
if ((size_t) (*length - 8) > Stream_GetRemainingLength(s))
return FALSE;
@ -299,7 +326,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
if (!mcs_recv_disconnect_provider_ultimatum(rdp->mcs, s, &reason))
return FALSE;
if (rdp->instance == NULL)
if (!rdp->instance)
{
rdp->disconnect = TRUE;
return FALSE;