[WIP] More tweaks to code.

This commit is contained in:
Nick Couchman 2020-04-05 13:42:21 -04:00
parent f9986a5787
commit 8d9d0fc097
2 changed files with 7 additions and 4 deletions

View File

@ -35,16 +35,19 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc,
guac_rdpsnd* rdpsnd = (guac_rdpsnd*) svc->data; guac_rdpsnd* rdpsnd = (guac_rdpsnd*) svc->data;
guac_rdpsnd_pdu_header header; guac_rdpsnd_pdu_header header;
/* Check size prior to trying to read data. */ /* Check that we at least have a header. */
if (Stream_GetRemainingLength(input_stream) < (sizeof(header) + header.body_size)) if (Stream_GetRemainingLength(input_stream) < sizeof(header))
return; return;
/* Read RDPSND PDU header */ /* Read RDPSND PDU header */
Stream_Read_UINT8(input_stream, header.message_type); Stream_Read_UINT8(input_stream, header.message_type);
Stream_Seek_UINT8(input_stream); Stream_Seek_UINT8(input_stream);
Stream_Read_UINT16(input_stream, header.body_size); Stream_Read_UINT16(input_stream, header.body_size);
/* Check that the body_size actually exists in the input stream. */
if (Stream_GetRemainingLength(input_stream) < header.body_size)
return;
/* /*
* If next PDU is SNDWAVE (due to receiving WaveInfo PDU previously), * If next PDU is SNDWAVE (due to receiving WaveInfo PDU previously),
* ignore the header and parse as a Wave PDU. * ignore the header and parse as a Wave PDU.

View File

@ -267,7 +267,7 @@ void guac_rdp_ai_process_formats(guac_client* client,
Stream_Seek_UINT32(stream); /* cbSizeFormatsPacket (MUST BE IGNORED) */ Stream_Seek_UINT32(stream); /* cbSizeFormatsPacket (MUST BE IGNORED) */
/* Check amount of data. */ /* Check amount of data. */
if (Stream_GetRemainingLength(stream) < (8 + nnum_formats)) if (Stream_GetRemainingLength(stream) < (8 + num_formats))
return; return;
UINT32 index; UINT32 index;