Fix users of Stream_GetPosition() that returns size_t
This commit is contained in:
parent
11ee81be60
commit
41823080f9
@ -42,7 +42,7 @@
|
|||||||
UINT cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
|
UINT cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
|
||||||
{
|
{
|
||||||
UINT32 index;
|
UINT32 index;
|
||||||
UINT32 position;
|
size_t position;
|
||||||
BOOL asciiNames;
|
BOOL asciiNames;
|
||||||
int formatNameLength;
|
int formatNameLength;
|
||||||
char* szFormatName;
|
char* szFormatName;
|
||||||
|
@ -89,7 +89,7 @@ static wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags,
|
|||||||
*/
|
*/
|
||||||
static UINT cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
|
static UINT cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
|
||||||
{
|
{
|
||||||
UINT32 pos;
|
size_t pos;
|
||||||
UINT32 dataLen;
|
UINT32 dataLen;
|
||||||
UINT status = CHANNEL_RC_OK;
|
UINT status = CHANNEL_RC_OK;
|
||||||
pos = Stream_GetPosition(s);
|
pos = Stream_GetPosition(s);
|
||||||
|
@ -91,7 +91,7 @@ wStream* cliprdr_server_packet_new(UINT16 msgType, UINT16 msgFlags,
|
|||||||
*/
|
*/
|
||||||
UINT cliprdr_server_packet_send(CliprdrServerPrivate* cliprdr, wStream* s)
|
UINT cliprdr_server_packet_send(CliprdrServerPrivate* cliprdr, wStream* s)
|
||||||
{
|
{
|
||||||
UINT32 pos;
|
size_t pos;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
UINT32 dataLen;
|
UINT32 dataLen;
|
||||||
UINT32 written;
|
UINT32 written;
|
||||||
@ -628,7 +628,7 @@ static UINT cliprdr_server_receive_format_list(CliprdrServerContext* context,
|
|||||||
{
|
{
|
||||||
UINT32 index;
|
UINT32 index;
|
||||||
UINT32 dataLen;
|
UINT32 dataLen;
|
||||||
UINT32 position;
|
size_t position;
|
||||||
BOOL asciiNames;
|
BOOL asciiNames;
|
||||||
int formatNameLength;
|
int formatNameLength;
|
||||||
char* szFormatName;
|
char* szFormatName;
|
||||||
@ -1185,7 +1185,7 @@ static UINT cliprdr_server_init(CliprdrServerContext* context)
|
|||||||
UINT cliprdr_server_read(CliprdrServerContext* context)
|
UINT cliprdr_server_read(CliprdrServerContext* context)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int position;
|
size_t position;
|
||||||
DWORD BytesToRead;
|
DWORD BytesToRead;
|
||||||
DWORD BytesReturned;
|
DWORD BytesReturned;
|
||||||
CLIPRDR_HEADER header;
|
CLIPRDR_HEADER header;
|
||||||
|
@ -727,7 +727,7 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId,
|
|||||||
const BYTE* data, UINT32 dataSize)
|
const BYTE* data, UINT32 dataSize)
|
||||||
{
|
{
|
||||||
wStream* data_out;
|
wStream* data_out;
|
||||||
unsigned long pos;
|
size_t pos;
|
||||||
UINT32 cbChId;
|
UINT32 cbChId;
|
||||||
UINT32 cbLen;
|
UINT32 cbLen;
|
||||||
unsigned long chunkLength;
|
unsigned long chunkLength;
|
||||||
@ -916,7 +916,7 @@ static UINT32 drdynvc_read_variable_uint(wStream* s, int cbLen)
|
|||||||
static UINT drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp,
|
static UINT drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp,
|
||||||
int cbChId, wStream* s)
|
int cbChId, wStream* s)
|
||||||
{
|
{
|
||||||
unsigned long pos;
|
size_t pos;
|
||||||
UINT status;
|
UINT status;
|
||||||
UINT32 ChannelId;
|
UINT32 ChannelId;
|
||||||
wStream* data_out;
|
wStream* data_out;
|
||||||
|
@ -1193,12 +1193,12 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
BYTE c;
|
BYTE c;
|
||||||
int pos;
|
size_t pos;
|
||||||
int index;
|
int index;
|
||||||
wStream* s;
|
wStream* s;
|
||||||
UINT32 count;
|
UINT32 count;
|
||||||
int data_len;
|
size_t data_len;
|
||||||
int count_pos;
|
size_t count_pos;
|
||||||
DEVICE* device;
|
DEVICE* device;
|
||||||
int keyCount;
|
int keyCount;
|
||||||
ULONG_PTR* pKeys;
|
ULONG_PTR* pKeys;
|
||||||
@ -1212,7 +1212,7 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
|
|||||||
|
|
||||||
Stream_Write_UINT16(s, RDPDR_CTYP_CORE); /* Component (2 bytes) */
|
Stream_Write_UINT16(s, RDPDR_CTYP_CORE); /* Component (2 bytes) */
|
||||||
Stream_Write_UINT16(s, PAKID_CORE_DEVICELIST_ANNOUNCE); /* PacketId (2 bytes) */
|
Stream_Write_UINT16(s, PAKID_CORE_DEVICELIST_ANNOUNCE); /* PacketId (2 bytes) */
|
||||||
count_pos = (int) Stream_GetPosition(s);
|
count_pos = Stream_GetPosition(s);
|
||||||
count = 0;
|
count = 0;
|
||||||
Stream_Seek_UINT32(s); /* deviceCount */
|
Stream_Seek_UINT32(s); /* deviceCount */
|
||||||
pKeys = NULL;
|
pKeys = NULL;
|
||||||
@ -1233,7 +1233,7 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
|
|||||||
if ((rdpdr->versionMinor == 0x0005) ||
|
if ((rdpdr->versionMinor == 0x0005) ||
|
||||||
(device->type == RDPDR_DTYP_SMARTCARD) || userLoggedOn)
|
(device->type == RDPDR_DTYP_SMARTCARD) || userLoggedOn)
|
||||||
{
|
{
|
||||||
data_len = (int)(device->data == NULL ? 0 : Stream_GetPosition(device->data));
|
data_len = (device->data == NULL ? 0 : Stream_GetPosition(device->data));
|
||||||
|
|
||||||
if (!Stream_EnsureRemainingCapacity(s, 20 + data_len))
|
if (!Stream_EnsureRemainingCapacity(s, 20 + data_len))
|
||||||
{
|
{
|
||||||
@ -1267,7 +1267,7 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(pKeys);
|
free(pKeys);
|
||||||
pos = (int) Stream_GetPosition(s);
|
pos = Stream_GetPosition(s);
|
||||||
Stream_SetPosition(s, count_pos);
|
Stream_SetPosition(s, count_pos);
|
||||||
Stream_Write_UINT32(s, count);
|
Stream_Write_UINT32(s, count);
|
||||||
Stream_SetPosition(s, pos);
|
Stream_SetPosition(s, pos);
|
||||||
|
@ -1138,7 +1138,7 @@ static UINT rdpgfx_recv_map_surface_to_window_pdu(RDPGFX_CHANNEL_CALLBACK* callb
|
|||||||
*/
|
*/
|
||||||
static UINT rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
|
static UINT rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
|
||||||
{
|
{
|
||||||
int beg, end;
|
size_t beg, end;
|
||||||
RDPGFX_HEADER header;
|
RDPGFX_HEADER header;
|
||||||
UINT error;
|
UINT error;
|
||||||
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
|
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
|
||||||
|
@ -1252,7 +1252,7 @@ static UINT rdpgfx_recv_qoe_frame_acknowledge_pdu(RdpgfxServerContext* context,
|
|||||||
*/
|
*/
|
||||||
static UINT rdpgfx_server_receive_pdu(RdpgfxServerContext* context, wStream* s)
|
static UINT rdpgfx_server_receive_pdu(RdpgfxServerContext* context, wStream* s)
|
||||||
{
|
{
|
||||||
int beg, end;
|
size_t beg, end;
|
||||||
RDPGFX_HEADER header;
|
RDPGFX_HEADER header;
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
beg = Stream_GetPosition(s);
|
beg = Stream_GetPosition(s);
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
UINT rdpsnd_server_send_formats(RdpsndServerContext* context, wStream* s)
|
UINT rdpsnd_server_send_formats(RdpsndServerContext* context, wStream* s)
|
||||||
{
|
{
|
||||||
int pos;
|
size_t pos;
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
ULONG written;
|
ULONG written;
|
||||||
@ -574,10 +574,11 @@ out:
|
|||||||
static UINT rdpsnd_server_set_volume(RdpsndServerContext* context, int left,
|
static UINT rdpsnd_server_set_volume(RdpsndServerContext* context, int left,
|
||||||
int right)
|
int right)
|
||||||
{
|
{
|
||||||
int pos;
|
size_t pos;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
ULONG written;
|
ULONG written;
|
||||||
wStream* s = context->priv->rdpsnd_pdu;
|
wStream* s = context->priv->rdpsnd_pdu;
|
||||||
|
|
||||||
Stream_Write_UINT8(s, SNDC_SETVOLUME);
|
Stream_Write_UINT8(s, SNDC_SETVOLUME);
|
||||||
Stream_Write_UINT8(s, 0);
|
Stream_Write_UINT8(s, 0);
|
||||||
Stream_Seek_UINT16(s);
|
Stream_Seek_UINT16(s);
|
||||||
@ -600,7 +601,7 @@ static UINT rdpsnd_server_set_volume(RdpsndServerContext* context, int left,
|
|||||||
*/
|
*/
|
||||||
static UINT rdpsnd_server_close(RdpsndServerContext* context)
|
static UINT rdpsnd_server_close(RdpsndServerContext* context)
|
||||||
{
|
{
|
||||||
int pos;
|
size_t pos;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
ULONG written;
|
ULONG written;
|
||||||
wStream* s = context->priv->rdpsnd_pdu;
|
wStream* s = context->priv->rdpsnd_pdu;
|
||||||
|
@ -482,7 +482,7 @@ UINT tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
|
|||||||
int num_rects = 0;
|
int num_rects = 0;
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
int i;
|
int i;
|
||||||
int pos;
|
size_t pos;
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(ifman->input) < GUID_SIZE + 32)
|
if (Stream_GetRemainingLength(ifman->input) < GUID_SIZE + 32)
|
||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
|
@ -123,7 +123,7 @@ BOOL tsmf_playback_ack(IWTSVirtualChannelCallback *pChannelCallback,
|
|||||||
*/
|
*/
|
||||||
static UINT tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream *data)
|
static UINT tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream *data)
|
||||||
{
|
{
|
||||||
int length;
|
size_t length;
|
||||||
wStream *input;
|
wStream *input;
|
||||||
wStream *output;
|
wStream *output;
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
@ -470,7 +470,7 @@ int freerdp_bitmap_compress(const char* srcData, int width, int height,
|
|||||||
int bicolor2;
|
int bicolor2;
|
||||||
int bicolor_spin;
|
int bicolor_spin;
|
||||||
int end;
|
int end;
|
||||||
int i;
|
size_t i;
|
||||||
int out_count;
|
int out_count;
|
||||||
int ypixel;
|
int ypixel;
|
||||||
int last_ypixel;
|
int last_ypixel;
|
||||||
|
@ -756,7 +756,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
|||||||
{
|
{
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
int i, close_cnt;
|
int i, close_cnt;
|
||||||
int pos;
|
size_t pos;
|
||||||
BYTE quant;
|
BYTE quant;
|
||||||
RFX_TILE* tile;
|
RFX_TILE* tile;
|
||||||
UINT32* quants;
|
UINT32* quants;
|
||||||
@ -999,7 +999,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length,
|
|||||||
UINT32 dstStride, UINT32 dstHeight,
|
UINT32 dstStride, UINT32 dstHeight,
|
||||||
REGION16* invalidRegion)
|
REGION16* invalidRegion)
|
||||||
{
|
{
|
||||||
int pos;
|
size_t pos;
|
||||||
REGION16 updateRegion;
|
REGION16 updateRegion;
|
||||||
UINT32 blockLen;
|
UINT32 blockLen;
|
||||||
UINT32 blockType;
|
UINT32 blockType;
|
||||||
|
@ -141,7 +141,8 @@ static void rdp_write_capability_set_header(wStream* s, UINT16 length,
|
|||||||
|
|
||||||
static int rdp_capability_set_start(wStream* s)
|
static int rdp_capability_set_start(wStream* s)
|
||||||
{
|
{
|
||||||
int header;
|
size_t header;
|
||||||
|
|
||||||
header = Stream_GetPosition(s);
|
header = Stream_GetPosition(s);
|
||||||
Stream_Zero(s, CAPSET_HEADER_LENGTH);
|
Stream_Zero(s, CAPSET_HEADER_LENGTH);
|
||||||
return header;
|
return header;
|
||||||
@ -149,8 +150,9 @@ static int rdp_capability_set_start(wStream* s)
|
|||||||
|
|
||||||
static void rdp_capability_set_finish(wStream* s, int header, UINT16 type)
|
static void rdp_capability_set_finish(wStream* s, int header, UINT16 type)
|
||||||
{
|
{
|
||||||
int footer;
|
size_t footer;
|
||||||
UINT16 length;
|
UINT16 length;
|
||||||
|
|
||||||
footer = Stream_GetPosition(s);
|
footer = Stream_GetPosition(s);
|
||||||
length = footer - header;
|
length = footer - header;
|
||||||
Stream_SetPosition(s, header);
|
Stream_SetPosition(s, header);
|
||||||
@ -3880,7 +3882,7 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s)
|
|||||||
|
|
||||||
BOOL rdp_write_demand_active(wStream* s, rdpSettings* settings)
|
BOOL rdp_write_demand_active(wStream* s, rdpSettings* settings)
|
||||||
{
|
{
|
||||||
int bm, em, lm;
|
size_t bm, em, lm;
|
||||||
UINT16 numberCapabilities;
|
UINT16 numberCapabilities;
|
||||||
UINT16 lengthCombinedCapabilities;
|
UINT16 lengthCombinedCapabilities;
|
||||||
|
|
||||||
@ -4034,7 +4036,7 @@ BOOL rdp_recv_confirm_active(rdpRdp* rdp, wStream* s)
|
|||||||
|
|
||||||
BOOL rdp_write_confirm_active(wStream* s, rdpSettings* settings)
|
BOOL rdp_write_confirm_active(wStream* s, rdpSettings* settings)
|
||||||
{
|
{
|
||||||
int bm, em, lm;
|
size_t bm, em, lm;
|
||||||
UINT16 numberCapabilities;
|
UINT16 numberCapabilities;
|
||||||
UINT16 lengthSourceDescriptor;
|
UINT16 lengthSourceDescriptor;
|
||||||
UINT16 lengthCombinedCapabilities;
|
UINT16 lengthCombinedCapabilities;
|
||||||
|
@ -451,7 +451,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
|
|||||||
int status;
|
int status;
|
||||||
UINT16 size;
|
UINT16 size;
|
||||||
rdpRdp* rdp;
|
rdpRdp* rdp;
|
||||||
int next_pos;
|
size_t next_pos;
|
||||||
wStream* cs;
|
wStream* cs;
|
||||||
int bulkStatus;
|
int bulkStatus;
|
||||||
UINT32 totalSize;
|
UINT32 totalSize;
|
||||||
|
@ -628,7 +628,7 @@ HttpResponse* http_response_recv(rdpTls* tls)
|
|||||||
int size;
|
int size;
|
||||||
int count;
|
int count;
|
||||||
int status;
|
int status;
|
||||||
int position;
|
size_t position;
|
||||||
char* line;
|
char* line;
|
||||||
char* buffer;
|
char* buffer;
|
||||||
char* header = NULL;
|
char* header = NULL;
|
||||||
|
@ -333,7 +333,7 @@ BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
|
|||||||
{
|
{
|
||||||
UINT16 type;
|
UINT16 type;
|
||||||
UINT16 blockLength;
|
UINT16 blockLength;
|
||||||
int begPos, endPos;
|
size_t begPos, endPos;
|
||||||
|
|
||||||
while (length > 0)
|
while (length > 0)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,7 @@ wStream* license_send_stream_init(rdpLicense* license)
|
|||||||
|
|
||||||
BOOL license_send(rdpLicense* license, wStream* s, BYTE type)
|
BOOL license_send(rdpLicense* license, wStream* s, BYTE type)
|
||||||
{
|
{
|
||||||
int length;
|
size_t length;
|
||||||
BYTE flags;
|
BYTE flags;
|
||||||
UINT16 wMsgSize;
|
UINT16 wMsgSize;
|
||||||
rdpRdp* rdp = license->rdp;
|
rdpRdp* rdp = license->rdp;
|
||||||
|
@ -325,7 +325,7 @@ static BOOL mcs_read_domain_parameters(wStream* s, DomainParameters* domainParam
|
|||||||
|
|
||||||
static BOOL mcs_write_domain_parameters(wStream* s, DomainParameters* domainParameters)
|
static BOOL mcs_write_domain_parameters(wStream* s, DomainParameters* domainParameters)
|
||||||
{
|
{
|
||||||
int length;
|
size_t length;
|
||||||
wStream* tmps;
|
wStream* tmps;
|
||||||
|
|
||||||
if (!s || !domainParameters)
|
if (!s || !domainParameters)
|
||||||
@ -672,9 +672,9 @@ out:
|
|||||||
BOOL mcs_send_connect_initial(rdpMcs* mcs)
|
BOOL mcs_send_connect_initial(rdpMcs* mcs)
|
||||||
{
|
{
|
||||||
int status = -1;
|
int status = -1;
|
||||||
int length;
|
size_t length;
|
||||||
wStream* s = NULL;
|
wStream* s = NULL;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
wStream* gcc_CCrq = NULL;
|
wStream* gcc_CCrq = NULL;
|
||||||
wStream* client_data = NULL;
|
wStream* client_data = NULL;
|
||||||
|
|
||||||
@ -782,10 +782,10 @@ BOOL mcs_recv_connect_response(rdpMcs* mcs, wStream* s)
|
|||||||
|
|
||||||
BOOL mcs_send_connect_response(rdpMcs* mcs)
|
BOOL mcs_send_connect_response(rdpMcs* mcs)
|
||||||
{
|
{
|
||||||
int length;
|
size_t length;
|
||||||
int status;
|
int status;
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
wStream* gcc_CCrsp;
|
wStream* gcc_CCrsp;
|
||||||
wStream* server_data;
|
wStream* server_data;
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ static BOOL nego_read_request_token_or_cookie(rdpNego* nego, wStream* s)
|
|||||||
|
|
||||||
BYTE *str = NULL;
|
BYTE *str = NULL;
|
||||||
UINT16 crlf = 0;
|
UINT16 crlf = 0;
|
||||||
int pos, len;
|
size_t pos, len;
|
||||||
BOOL result = FALSE;
|
BOOL result = FALSE;
|
||||||
BOOL isToken = FALSE;
|
BOOL isToken = FALSE;
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
|||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int length;
|
int length;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
BYTE flags = 0;
|
BYTE flags = 0;
|
||||||
int cookie_length;
|
int cookie_length;
|
||||||
|
|
||||||
@ -997,7 +997,7 @@ void nego_process_negotiation_failure(rdpNego* nego, wStream* s)
|
|||||||
BOOL nego_send_negotiation_response(rdpNego* nego)
|
BOOL nego_send_negotiation_response(rdpNego* nego)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
wStream* s;
|
wStream* s;
|
||||||
BYTE flags;
|
BYTE flags;
|
||||||
|
@ -557,7 +557,7 @@ BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
|
|||||||
{
|
{
|
||||||
UINT16 length;
|
UINT16 length;
|
||||||
UINT32 sec_bytes;
|
UINT32 sec_bytes;
|
||||||
int sec_hold;
|
size_t sec_hold;
|
||||||
UINT32 pad;
|
UINT32 pad;
|
||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
@ -584,9 +584,9 @@ BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
|
|||||||
|
|
||||||
BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
|
BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
|
||||||
{
|
{
|
||||||
UINT16 length;
|
size_t length;
|
||||||
UINT32 sec_bytes;
|
UINT32 sec_bytes;
|
||||||
int sec_hold;
|
size_t sec_hold;
|
||||||
UINT32 pad;
|
UINT32 pad;
|
||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
@ -604,7 +604,8 @@ BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
|
|||||||
Stream_SetPosition(s, length);
|
Stream_SetPosition(s, length);
|
||||||
Stream_SealLength(s);
|
Stream_SealLength(s);
|
||||||
|
|
||||||
WLog_DBG(TAG, "%s: sending data (type=0x%x size=%d channelId=%d)", __FUNCTION__, type, Stream_Length(s), channel_id);
|
WLog_DBG(TAG, "%s: sending data (type=0x%x size=%"PRIuz" channelId=%"PRIu16")", __FUNCTION__,
|
||||||
|
type, Stream_Length(s), channel_id);
|
||||||
if (transport_write(rdp->transport, s) < 0)
|
if (transport_write(rdp->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -615,7 +616,7 @@ BOOL rdp_send_message_channel_pdu(rdpRdp* rdp, wStream* s, UINT16 sec_flags)
|
|||||||
{
|
{
|
||||||
UINT16 length;
|
UINT16 length;
|
||||||
UINT32 sec_bytes;
|
UINT32 sec_bytes;
|
||||||
int sec_hold;
|
size_t sec_hold;
|
||||||
UINT32 pad;
|
UINT32 pad;
|
||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
@ -1139,7 +1140,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
UINT16 pduSource;
|
UINT16 pduSource;
|
||||||
UINT16 channelId = 0;
|
UINT16 channelId = 0;
|
||||||
UINT16 securityFlags = 0;
|
UINT16 securityFlags = 0;
|
||||||
int nextPosition;
|
size_t nextPosition;
|
||||||
|
|
||||||
if (!rdp_read_header(rdp, s, &length, &channelId))
|
if (!rdp_read_header(rdp, s, &length, &channelId))
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
static BOOL update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s, UINT32* length)
|
static BOOL update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s, UINT32* length)
|
||||||
{
|
{
|
||||||
int pos;
|
size_t pos;
|
||||||
SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command;
|
SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command;
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 20)
|
if (Stream_GetRemainingLength(s) < 20)
|
||||||
|
@ -161,8 +161,8 @@ void tpdu_write_connection_request(wStream* s, UINT16 length)
|
|||||||
BOOL tpdu_read_connection_confirm(wStream* s, BYTE* li)
|
BOOL tpdu_read_connection_confirm(wStream* s, BYTE* li)
|
||||||
{
|
{
|
||||||
BYTE code;
|
BYTE code;
|
||||||
int position;
|
size_t position;
|
||||||
int bytes_read = 0;
|
size_t bytes_read = 0;
|
||||||
|
|
||||||
/* save the position to determine the number of bytes read */
|
/* save the position to determine the number of bytes read */
|
||||||
position = Stream_GetPosition(s);
|
position = Stream_GetPosition(s);
|
||||||
|
@ -642,7 +642,7 @@ static int transport_read_layer_bytes(rdpTransport* transport, wStream* s,
|
|||||||
int transport_read_pdu(rdpTransport* transport, wStream* s)
|
int transport_read_pdu(rdpTransport* transport, wStream* s)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int position;
|
size_t position;
|
||||||
int pduLength;
|
int pduLength;
|
||||||
BYTE* header;
|
BYTE* header;
|
||||||
pduLength = 0;
|
pduLength = 0;
|
||||||
@ -767,8 +767,7 @@ int transport_read_pdu(rdpTransport* transport, wStream* s)
|
|||||||
if (!Stream_EnsureCapacity(s, Stream_GetPosition(s) + pduLength))
|
if (!Stream_EnsureCapacity(s, Stream_GetPosition(s) + pduLength))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
status = transport_read_layer_bytes(transport, s,
|
status = transport_read_layer_bytes(transport, s, pduLength - Stream_GetPosition(s));
|
||||||
pduLength - Stream_GetPosition(s));
|
|
||||||
|
|
||||||
if (status != 1)
|
if (status != 1)
|
||||||
return status;
|
return status;
|
||||||
@ -784,7 +783,7 @@ int transport_read_pdu(rdpTransport* transport, wStream* s)
|
|||||||
|
|
||||||
int transport_write(rdpTransport* transport, wStream* s)
|
int transport_write(rdpTransport* transport, wStream* s)
|
||||||
{
|
{
|
||||||
int length;
|
size_t length;
|
||||||
int status = -1;
|
int status = -1;
|
||||||
int writtenlength = 0;
|
int writtenlength = 0;
|
||||||
|
|
||||||
|
@ -835,7 +835,7 @@ static int update_prepare_order_info(rdpContext* context,
|
|||||||
int update_write_order_info(rdpContext* context, wStream* s,
|
int update_write_order_info(rdpContext* context, wStream* s,
|
||||||
ORDER_INFO* orderInfo, int offset)
|
ORDER_INFO* orderInfo, int offset)
|
||||||
{
|
{
|
||||||
int position;
|
size_t position;
|
||||||
position = Stream_GetPosition(s);
|
position = Stream_GetPosition(s);
|
||||||
Stream_SetPosition(s, offset);
|
Stream_SetPosition(s, offset);
|
||||||
Stream_Write_UINT8(s, orderInfo->controlFlags); /* controlFlags (1 byte) */
|
Stream_Write_UINT8(s, orderInfo->controlFlags); /* controlFlags (1 byte) */
|
||||||
@ -1188,7 +1188,7 @@ static BOOL update_send_dstblt(rdpContext* context,
|
|||||||
static BOOL update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
static BOOL update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int offset;
|
size_t offset;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
ORDER_INFO orderInfo;
|
ORDER_INFO orderInfo;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1246,7 +1246,7 @@ static BOOL update_send_opaque_rect(rdpContext* context,
|
|||||||
const OPAQUE_RECT_ORDER* opaque_rect)
|
const OPAQUE_RECT_ORDER* opaque_rect)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int offset;
|
size_t offset;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
ORDER_INFO orderInfo;
|
ORDER_INFO orderInfo;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1304,7 +1304,7 @@ static BOOL update_send_line_to(rdpContext* context,
|
|||||||
static BOOL update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
static BOOL update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int offset;
|
size_t offset;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
ORDER_INFO orderInfo;
|
ORDER_INFO orderInfo;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1333,7 +1333,7 @@ static BOOL update_send_glyph_index(rdpContext* context,
|
|||||||
GLYPH_INDEX_ORDER* glyph_index)
|
GLYPH_INDEX_ORDER* glyph_index)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int offset;
|
size_t offset;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
int inf;
|
int inf;
|
||||||
ORDER_INFO orderInfo;
|
ORDER_INFO orderInfo;
|
||||||
@ -1367,7 +1367,7 @@ static BOOL update_send_cache_bitmap(rdpContext* context,
|
|||||||
const CACHE_BITMAP_ORDER* cache_bitmap)
|
const CACHE_BITMAP_ORDER* cache_bitmap)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
BYTE orderType;
|
BYTE orderType;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
int inf;
|
int inf;
|
||||||
@ -1415,7 +1415,7 @@ static BOOL update_send_cache_bitmap_v2(rdpContext* context,
|
|||||||
CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
|
CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
BYTE orderType;
|
BYTE orderType;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
UINT16 extraFlags;
|
UINT16 extraFlags;
|
||||||
@ -1465,7 +1465,7 @@ static BOOL update_send_cache_bitmap_v3(rdpContext* context,
|
|||||||
CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
|
CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int bm, em;
|
size_t bm, em;
|
||||||
BYTE orderType;
|
BYTE orderType;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
UINT16 extraFlags;
|
UINT16 extraFlags;
|
||||||
@ -1510,7 +1510,7 @@ static BOOL update_send_cache_color_table(rdpContext* context,
|
|||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
int bm, em, inf;
|
size_t bm, em, inf;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
INT16 orderLength;
|
INT16 orderLength;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1551,7 +1551,7 @@ static BOOL update_send_cache_glyph(rdpContext* context,
|
|||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
int bm, em, inf;
|
size_t bm, em, inf;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
INT16 orderLength;
|
INT16 orderLength;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1592,7 +1592,7 @@ static BOOL update_send_cache_glyph_v2(rdpContext* context,
|
|||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
int bm, em, inf;
|
size_t bm, em, inf;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
INT16 orderLength;
|
INT16 orderLength;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1618,8 +1618,7 @@ static BOOL update_send_cache_glyph_v2(rdpContext* context,
|
|||||||
em = Stream_GetPosition(s);
|
em = Stream_GetPosition(s);
|
||||||
orderLength = (em - bm) - 13;
|
orderLength = (em - bm) - 13;
|
||||||
Stream_SetPosition(s, bm);
|
Stream_SetPosition(s, bm);
|
||||||
Stream_Write_UINT8(s, ORDER_STANDARD |
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY); /* controlFlags (1 byte) */
|
||||||
ORDER_SECONDARY); /* controlFlags (1 byte) */
|
|
||||||
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||||
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
||||||
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
||||||
@ -1633,7 +1632,7 @@ static BOOL update_send_cache_brush(rdpContext* context,
|
|||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
int bm, em, inf;
|
size_t bm, em, inf;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
INT16 orderLength;
|
INT16 orderLength;
|
||||||
rdpUpdate* update = context->update;
|
rdpUpdate* update = context->update;
|
||||||
@ -1678,7 +1677,7 @@ static BOOL update_send_create_offscreen_bitmap_order(
|
|||||||
const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
|
const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int bm, em, inf;
|
size_t bm, em, inf;
|
||||||
BYTE orderType;
|
BYTE orderType;
|
||||||
BYTE controlFlags;
|
BYTE controlFlags;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
@ -1717,7 +1716,7 @@ static BOOL update_send_switch_surface_order(
|
|||||||
const SWITCH_SURFACE_ORDER* switch_surface)
|
const SWITCH_SURFACE_ORDER* switch_surface)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int bm, em, inf;
|
size_t bm, em, inf;
|
||||||
BYTE orderType;
|
BYTE orderType;
|
||||||
BYTE controlFlags;
|
BYTE controlFlags;
|
||||||
int headerLength;
|
int headerLength;
|
||||||
|
@ -192,7 +192,7 @@ void ntlm_print_message_fields(NTLM_MESSAGE_FIELDS* fields, const char* name)
|
|||||||
SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int length;
|
size_t length;
|
||||||
NTLM_NEGOTIATE_MESSAGE* message;
|
NTLM_NEGOTIATE_MESSAGE* message;
|
||||||
message = &context->NEGOTIATE_MESSAGE;
|
message = &context->NEGOTIATE_MESSAGE;
|
||||||
ZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));
|
ZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));
|
||||||
@ -261,7 +261,7 @@ SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buf
|
|||||||
SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int length;
|
size_t length;
|
||||||
NTLM_NEGOTIATE_MESSAGE* message;
|
NTLM_NEGOTIATE_MESSAGE* message;
|
||||||
message = &context->NEGOTIATE_MESSAGE;
|
message = &context->NEGOTIATE_MESSAGE;
|
||||||
ZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));
|
ZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));
|
||||||
@ -503,7 +503,7 @@ SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buf
|
|||||||
SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int length;
|
size_t length;
|
||||||
UINT32 PayloadOffset;
|
UINT32 PayloadOffset;
|
||||||
NTLM_CHALLENGE_MESSAGE* message;
|
NTLM_CHALLENGE_MESSAGE* message;
|
||||||
message = &context->CHALLENGE_MESSAGE;
|
message = &context->CHALLENGE_MESSAGE;
|
||||||
@ -593,7 +593,7 @@ SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer bu
|
|||||||
SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int length;
|
size_t length;
|
||||||
UINT32 flags;
|
UINT32 flags;
|
||||||
NTLM_AV_PAIR* AvFlags;
|
NTLM_AV_PAIR* AvFlags;
|
||||||
UINT32 PayloadBufferOffset;
|
UINT32 PayloadBufferOffset;
|
||||||
@ -784,7 +784,7 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer
|
|||||||
SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||||
{
|
{
|
||||||
wStream* s;
|
wStream* s;
|
||||||
int length;
|
size_t length;
|
||||||
UINT32 PayloadBufferOffset;
|
UINT32 PayloadBufferOffset;
|
||||||
NTLM_AUTHENTICATE_MESSAGE* message;
|
NTLM_AUTHENTICATE_MESSAGE* message;
|
||||||
SSPI_CREDENTIALS* credentials = context->credentials;
|
SSPI_CREDENTIALS* credentials = context->credentials;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <winpr/print.h>
|
#include <winpr/print.h>
|
||||||
#include <winpr/stream.h>
|
#include <winpr/stream.h>
|
||||||
|
|
||||||
static BOOL TestStream_Verify(wStream* s, int mincap, int len, int pos)
|
static BOOL TestStream_Verify(wStream* s, int mincap, int len, size_t pos)
|
||||||
{
|
{
|
||||||
if (Stream_Buffer(s) == NULL)
|
if (Stream_Buffer(s) == NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user