[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,15 +35,18 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc,
guac_rdpsnd* rdpsnd = (guac_rdpsnd*) svc->data;
guac_rdpsnd_pdu_header header;
/* Check size prior to trying to read data. */
if (Stream_GetRemainingLength(input_stream) < (sizeof(header) + header.body_size))
/* Check that we at least have a header. */
if (Stream_GetRemainingLength(input_stream) < sizeof(header))
return;
/* Read RDPSND PDU header */
Stream_Read_UINT8(input_stream, header.message_type);
Stream_Seek_UINT8(input_stream);
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),

View File

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