mirror of https://github.com/FreeRDP/FreeRDP
[core,rdp] log rdp_read_share_control_header
in rdp_read_share_control_header read and log all available header data before checking remaining length.
This commit is contained in:
parent
00b393c094
commit
9a7aa8dbac
|
@ -211,6 +211,11 @@ BOOL rdp_read_share_control_header(rdpRdp* rdp, wStream* s, UINT16* tpktLength,
|
||||||
*tpktLength = 8; /* Flow control PDU is 8 bytes */
|
*tpktLength = 8; /* Flow control PDU is 8 bytes */
|
||||||
if (remainingLength)
|
if (remainingLength)
|
||||||
*remainingLength = 0;
|
*remainingLength = 0;
|
||||||
|
|
||||||
|
char buffer[128] = { 0 };
|
||||||
|
WLog_Print(rdp->log, WLOG_DEBUG,
|
||||||
|
"[Flow control PDU] type=%s, tpktLength=%" PRIuz ", remainingLength=%" PRIuz,
|
||||||
|
pdu_type_to_str(*type, buffer, sizeof(buffer)), *tpktLength, *remainingLength);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,27 +226,33 @@ BOOL rdp_read_share_control_header(rdpRdp* rdp, wStream* s, UINT16* tpktLength,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Stream_CheckAndLogRequiredLengthWLog(rdp->log, s, len - 2))
|
|
||||||
return FALSE;
|
|
||||||
if (tpktLength)
|
if (tpktLength)
|
||||||
*tpktLength = len;
|
*tpktLength = len;
|
||||||
|
|
||||||
|
if (!Stream_CheckAndLogRequiredLengthWLog(rdp->log, s, 2))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
Stream_Read_UINT16(s, tmp); /* pduType */
|
Stream_Read_UINT16(s, tmp); /* pduType */
|
||||||
*type = tmp & 0x0F; /* type is in the 4 least significant bits */
|
*type = tmp & 0x0F; /* type is in the 4 least significant bits */
|
||||||
|
|
||||||
|
size_t remLen = len - 4;
|
||||||
if (len > 5)
|
if (len > 5)
|
||||||
{
|
{
|
||||||
|
if (!Stream_CheckAndLogRequiredLengthWLog(rdp->log, s, 2))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
Stream_Read_UINT16(s, *channel_id); /* pduSource */
|
Stream_Read_UINT16(s, *channel_id); /* pduSource */
|
||||||
if (remainingLength)
|
remLen = len - 6;
|
||||||
*remainingLength = len - 6;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
*channel_id = 0; /* Windows XP can send such short DEACTIVATE_ALL PDUs. */
|
*channel_id = 0; /* Windows XP can send such short DEACTIVATE_ALL PDUs. */
|
||||||
if (remainingLength)
|
|
||||||
*remainingLength = len - 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
char buffer[128] = { 0 };
|
||||||
|
WLog_Print(rdp->log, WLOG_DEBUG, "type=%s, tpktLength=%" PRIuz ", remainingLength=%" PRIuz,
|
||||||
|
pdu_type_to_str(*type, buffer, sizeof(buffer)), len, remLen);
|
||||||
|
if (remainingLength)
|
||||||
|
*remainingLength = remLen;
|
||||||
|
return Stream_CheckAndLogRequiredLengthWLog(rdp->log, s, remLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL rdp_write_share_control_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 type,
|
BOOL rdp_write_share_control_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 type,
|
||||||
|
|
Loading…
Reference in New Issue