Fix users of Stream_GetPosition() that returns size_t
authorDavid Fort <contact@hardening-consulting.com>
Mon, 11 Dec 2017 09:25:21 +0000 (10:25 +0100)
committerDavid Fort <contact@hardening-consulting.com>
Mon, 11 Dec 2017 21:38:58 +0000 (22:38 +0100)
26 files changed:
channels/cliprdr/client/cliprdr_format.c
channels/cliprdr/client/cliprdr_main.c
channels/cliprdr/server/cliprdr_main.c
channels/drdynvc/client/drdynvc_main.c
channels/rdpdr/client/rdpdr_main.c
channels/rdpgfx/client/rdpgfx_main.c
channels/rdpgfx/server/rdpgfx_main.c
channels/rdpsnd/server/rdpsnd_main.c
channels/tsmf/client/tsmf_ifman.c
channels/tsmf/client/tsmf_main.c
libfreerdp/codec/bitmap.c
libfreerdp/codec/rfx.c
libfreerdp/core/capabilities.c
libfreerdp/core/fastpath.c
libfreerdp/core/gateway/http.c
libfreerdp/core/gcc.c
libfreerdp/core/license.c
libfreerdp/core/mcs.c
libfreerdp/core/nego.c
libfreerdp/core/rdp.c
libfreerdp/core/surface.c
libfreerdp/core/tpdu.c
libfreerdp/core/transport.c
libfreerdp/core/update.c
winpr/libwinpr/sspi/NTLM/ntlm_message.c
winpr/libwinpr/utils/test/TestStream.c

index 12ffdce..a97a584 100644 (file)
@@ -42,7 +42,7 @@
 UINT cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
 {
        UINT32 index;
-       UINT32 position;
+       size_t position;
        BOOL asciiNames;
        int formatNameLength;
        char* szFormatName;
index 51d283c..7b28298 100644 (file)
@@ -89,7 +89,7 @@ static wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags,
  */
 static UINT cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
 {
-       UINT32 pos;
+       size_t pos;
        UINT32 dataLen;
        UINT status = CHANNEL_RC_OK;
        pos = Stream_GetPosition(s);
index 1b8268e..30392cb 100644 (file)
@@ -91,7 +91,7 @@ wStream* cliprdr_server_packet_new(UINT16 msgType, UINT16 msgFlags,
  */
 UINT cliprdr_server_packet_send(CliprdrServerPrivate* cliprdr, wStream* s)
 {
-       UINT32 pos;
+       size_t pos;
        BOOL status;
        UINT32 dataLen;
        UINT32 written;
@@ -628,7 +628,7 @@ static UINT cliprdr_server_receive_format_list(CliprdrServerContext* context,
 {
        UINT32 index;
        UINT32 dataLen;
-       UINT32 position;
+       size_t position;
        BOOL asciiNames;
        int formatNameLength;
        char* szFormatName;
@@ -1185,7 +1185,7 @@ static UINT cliprdr_server_init(CliprdrServerContext* context)
 UINT cliprdr_server_read(CliprdrServerContext* context)
 {
        wStream* s;
-       int position;
+       size_t position;
        DWORD BytesToRead;
        DWORD BytesReturned;
        CLIPRDR_HEADER header;
index f1b8d3b..a36baf0 100644 (file)
@@ -727,7 +727,7 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId,
                                const BYTE* data, UINT32 dataSize)
 {
        wStream* data_out;
-       unsigned long pos;
+       size_t pos;
        UINT32 cbChId;
        UINT32 cbLen;
        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,
         int cbChId, wStream* s)
 {
-       unsigned long pos;
+       size_t pos;
        UINT status;
        UINT32 ChannelId;
        wStream* data_out;
index 732fb60..ff00521 100644 (file)
@@ -1193,12 +1193,12 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
 {
        int i;
        BYTE c;
-       int pos;
+       size_t pos;
        int index;
        wStream* s;
        UINT32 count;
-       int data_len;
-       int count_pos;
+       size_t data_len;
+       size_t count_pos;
        DEVICE* device;
        int keyCount;
        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, PAKID_CORE_DEVICELIST_ANNOUNCE); /* PacketId (2 bytes) */
-       count_pos = (int) Stream_GetPosition(s);
+       count_pos = Stream_GetPosition(s);
        count = 0;
        Stream_Seek_UINT32(s); /* deviceCount */
        pKeys = NULL;
@@ -1233,7 +1233,7 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
                if ((rdpdr->versionMinor == 0x0005) ||
                    (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))
                        {
@@ -1267,7 +1267,7 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
        }
 
        free(pKeys);
-       pos = (int) Stream_GetPosition(s);
+       pos = Stream_GetPosition(s);
        Stream_SetPosition(s, count_pos);
        Stream_Write_UINT32(s, count);
        Stream_SetPosition(s, pos);
index 69c90f3..3c70c86 100644 (file)
@@ -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)
 {
-       int beg, end;
+       size_t beg, end;
        RDPGFX_HEADER header;
        UINT error;
        RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
index 632b984..4be9be7 100644 (file)
@@ -1252,7 +1252,7 @@ static UINT rdpgfx_recv_qoe_frame_acknowledge_pdu(RdpgfxServerContext* context,
  */
 static UINT rdpgfx_server_receive_pdu(RdpgfxServerContext* context, wStream* s)
 {
-       int beg, end;
+       size_t beg, end;
        RDPGFX_HEADER header;
        UINT error = CHANNEL_RC_OK;
        beg = Stream_GetPosition(s);
index 844a485..ee1e411 100644 (file)
@@ -42,7 +42,7 @@
  */
 UINT rdpsnd_server_send_formats(RdpsndServerContext* context, wStream* s)
 {
-       int pos;
+       size_t pos;
        UINT16 i;
        BOOL status;
        ULONG written;
@@ -574,10 +574,11 @@ out:
 static UINT rdpsnd_server_set_volume(RdpsndServerContext* context, int left,
                                      int right)
 {
-       int pos;
+       size_t pos;
        BOOL status;
        ULONG written;
        wStream* s = context->priv->rdpsnd_pdu;
+
        Stream_Write_UINT8(s, SNDC_SETVOLUME);
        Stream_Write_UINT8(s, 0);
        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)
 {
-       int pos;
+       size_t pos;
        BOOL status;
        ULONG written;
        wStream* s = context->priv->rdpsnd_pdu;
index 5af0e7b..9fcc620 100644 (file)
@@ -482,7 +482,7 @@ UINT tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
        int num_rects = 0;
        UINT error = CHANNEL_RC_OK;
        int i;
-       int pos;
+       size_t pos;
 
        if (Stream_GetRemainingLength(ifman->input) < GUID_SIZE + 32)
                return ERROR_INVALID_DATA;
index 259eb55..a6339be 100644 (file)
@@ -123,7 +123,7 @@ BOOL tsmf_playback_ack(IWTSVirtualChannelCallback *pChannelCallback,
  */
 static UINT tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream *data)
 {
-       int length;
+       size_t length;
        wStream *input;
        wStream *output;
        UINT error = CHANNEL_RC_OK;
index 7cf4512..c260309 100644 (file)
@@ -470,7 +470,7 @@ int freerdp_bitmap_compress(const char* srcData, int width, int height,
        int bicolor2;
        int bicolor_spin;
        int end;
-       int i;
+       size_t i;
        int out_count;
        int ypixel;
        int last_ypixel;
index 39b9782..38cc3d0 100644 (file)
@@ -756,7 +756,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
 {
        BOOL rc;
        int i, close_cnt;
-       int pos;
+       size_t pos;
        BYTE quant;
        RFX_TILE* tile;
        UINT32* quants;
@@ -999,7 +999,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length,
                          UINT32 dstStride, UINT32 dstHeight,
                          REGION16* invalidRegion)
 {
-       int pos;
+       size_t pos;
        REGION16 updateRegion;
        UINT32 blockLen;
        UINT32 blockType;
index f97918a..e1da03f 100644 (file)
@@ -141,7 +141,8 @@ static void rdp_write_capability_set_header(wStream* s, UINT16 length,
 
 static int rdp_capability_set_start(wStream* s)
 {
-       int header;
+       size_t header;
+
        header = Stream_GetPosition(s);
        Stream_Zero(s, CAPSET_HEADER_LENGTH);
        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)
 {
-       int footer;
+       size_t footer;
        UINT16 length;
+
        footer = Stream_GetPosition(s);
        length = footer - 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)
 {
-       int bm, em, lm;
+       size_t bm, em, lm;
        UINT16 numberCapabilities;
        UINT16 lengthCombinedCapabilities;
 
@@ -4034,7 +4036,7 @@ BOOL rdp_recv_confirm_active(rdpRdp* rdp, wStream* s)
 
 BOOL rdp_write_confirm_active(wStream* s, rdpSettings* settings)
 {
-       int bm, em, lm;
+       size_t bm, em, lm;
        UINT16 numberCapabilities;
        UINT16 lengthSourceDescriptor;
        UINT16 lengthCombinedCapabilities;
index 04c3fc4..7ddd3cc 100644 (file)
@@ -451,7 +451,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
        int status;
        UINT16 size;
        rdpRdp* rdp;
-       int next_pos;
+       size_t next_pos;
        wStream* cs;
        int bulkStatus;
        UINT32 totalSize;
index ff7a981..55b43b6 100644 (file)
@@ -628,7 +628,7 @@ HttpResponse* http_response_recv(rdpTls* tls)
        int size;
        int count;
        int status;
-       int position;
+       size_t position;
        char* line;
        char* buffer;
        char* header = NULL;
index 410a974..759468c 100644 (file)
@@ -333,7 +333,7 @@ BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
 {
        UINT16 type;
        UINT16 blockLength;
-       int begPos, endPos;
+       size_t begPos, endPos;
 
        while (length > 0)
        {
index fc2d6b3..ed8b68a 100644 (file)
@@ -233,7 +233,7 @@ wStream* license_send_stream_init(rdpLicense* license)
 
 BOOL license_send(rdpLicense* license, wStream* s, BYTE type)
 {
-       int length;
+       size_t length;
        BYTE flags;
        UINT16 wMsgSize;
        rdpRdp* rdp = license->rdp;
index cadaa9f..ae78fdc 100644 (file)
@@ -325,7 +325,7 @@ static BOOL mcs_read_domain_parameters(wStream* s, DomainParameters* domainParam
 
 static BOOL mcs_write_domain_parameters(wStream* s, DomainParameters* domainParameters)
 {
-       int length;
+       size_t length;
        wStream* tmps;
 
        if (!s || !domainParameters)
@@ -672,9 +672,9 @@ out:
 BOOL mcs_send_connect_initial(rdpMcs* mcs)
 {
        int status = -1;
-       int length;
+       size_t length;
        wStream* s = NULL;
-       int bm, em;
+       size_t bm, em;
        wStream* gcc_CCrq = 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)
 {
-       int length;
+       size_t length;
        int status;
        wStream* s;
-       int bm, em;
+       size_t bm, em;
        wStream* gcc_CCrsp;
        wStream* server_data;
 
index 068a603..ab4db4e 100644 (file)
@@ -665,7 +665,7 @@ static BOOL nego_read_request_token_or_cookie(rdpNego* nego, wStream* s)
 
        BYTE *str = NULL;
        UINT16 crlf = 0;
-       int pos, len;
+       size_t pos, len;
        BOOL result = FALSE;
        BOOL isToken = FALSE;
 
@@ -808,7 +808,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
 {
        wStream* s;
        int length;
-       int bm, em;
+       size_t bm, em;
        BYTE flags = 0;
        int cookie_length;
 
@@ -834,7 +834,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
                                (nego->RoutingToken[nego->RoutingTokenLength - 1] == 0x0A))
                {
                        WLog_DBG(TAG, "Routing token looks correctly terminated - use verbatim");
-                       length +=nego->RoutingTokenLength;
+                       length += nego->RoutingTokenLength;
                }
                else
                {
@@ -997,7 +997,7 @@ void nego_process_negotiation_failure(rdpNego* nego, wStream* s)
 BOOL nego_send_negotiation_response(rdpNego* nego)
 {
        int length;
-       int bm, em;
+       size_t bm, em;
        BOOL status;
        wStream* s;
        BYTE flags;
index 0b6cdf4..ebd6de5 100644 (file)
@@ -557,7 +557,7 @@ BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
 {
        UINT16 length;
        UINT32 sec_bytes;
-       int sec_hold;
+       size_t sec_hold;
        UINT32 pad;
 
        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)
 {
-       UINT16 length;
+       size_t length;
        UINT32 sec_bytes;
-       int sec_hold;
+       size_t sec_hold;
        UINT32 pad;
 
        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_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)
                return FALSE;
 
@@ -615,7 +616,7 @@ BOOL rdp_send_message_channel_pdu(rdpRdp* rdp, wStream* s, UINT16 sec_flags)
 {
        UINT16 length;
        UINT32 sec_bytes;
-       int sec_hold;
+       size_t sec_hold;
        UINT32 pad;
 
        length = Stream_GetPosition(s);
@@ -1139,7 +1140,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
        UINT16 pduSource;
        UINT16 channelId = 0;
        UINT16 securityFlags = 0;
-       int nextPosition;
+       size_t nextPosition;
 
        if (!rdp_read_header(rdp, s, &length, &channelId))
        {
index 9eefb0f..90f5dbe 100644 (file)
@@ -30,7 +30,7 @@
 
 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;
 
        if (Stream_GetRemainingLength(s) < 20)
index 441b090..9c94d89 100644 (file)
@@ -161,8 +161,8 @@ void tpdu_write_connection_request(wStream* s, UINT16 length)
 BOOL tpdu_read_connection_confirm(wStream* s, BYTE* li)
 {
        BYTE code;
-       int position;
-       int bytes_read = 0;
+       size_t position;
+       size_t bytes_read = 0;
 
        /* save the position to determine the number of bytes read */
        position = Stream_GetPosition(s);
index 400cd95..d462e1b 100644 (file)
@@ -642,7 +642,7 @@ static int transport_read_layer_bytes(rdpTransport* transport, wStream* s,
 int transport_read_pdu(rdpTransport* transport, wStream* s)
 {
        int status;
-       int position;
+       size_t position;
        int pduLength;
        BYTE* header;
        pduLength = 0;
@@ -767,8 +767,7 @@ int transport_read_pdu(rdpTransport* transport, wStream* s)
        if (!Stream_EnsureCapacity(s, Stream_GetPosition(s) + pduLength))
                return -1;
 
-       status = transport_read_layer_bytes(transport, s,
-                                           pduLength - Stream_GetPosition(s));
+       status = transport_read_layer_bytes(transport, s, pduLength - Stream_GetPosition(s));
 
        if (status != 1)
                return status;
@@ -784,7 +783,7 @@ int transport_read_pdu(rdpTransport* transport, wStream* s)
 
 int transport_write(rdpTransport* transport, wStream* s)
 {
-       int length;
+       size_t length;
        int status = -1;
        int writtenlength = 0;
 
index b0f2f90..2779aec 100644 (file)
@@ -835,7 +835,7 @@ static int update_prepare_order_info(rdpContext* context,
 int update_write_order_info(rdpContext* context, wStream* s,
                             ORDER_INFO* orderInfo, int offset)
 {
-       int position;
+       size_t position;
        position = Stream_GetPosition(s);
        Stream_SetPosition(s, offset);
        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)
 {
        wStream* s;
-       int offset;
+       size_t offset;
        int headerLength;
        ORDER_INFO orderInfo;
        rdpUpdate* update = context->update;
@@ -1246,7 +1246,7 @@ static BOOL update_send_opaque_rect(rdpContext* context,
                                     const OPAQUE_RECT_ORDER* opaque_rect)
 {
        wStream* s;
-       int offset;
+       size_t offset;
        int headerLength;
        ORDER_INFO orderInfo;
        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)
 {
        wStream* s;
-       int offset;
+       size_t offset;
        int headerLength;
        ORDER_INFO orderInfo;
        rdpUpdate* update = context->update;
@@ -1333,7 +1333,7 @@ static BOOL update_send_glyph_index(rdpContext* context,
                                     GLYPH_INDEX_ORDER* glyph_index)
 {
        wStream* s;
-       int offset;
+       size_t offset;
        int headerLength;
        int inf;
        ORDER_INFO orderInfo;
@@ -1367,7 +1367,7 @@ static BOOL update_send_cache_bitmap(rdpContext* context,
                                      const CACHE_BITMAP_ORDER* cache_bitmap)
 {
        wStream* s;
-       int bm, em;
+       size_t bm, em;
        BYTE orderType;
        int headerLength;
        int inf;
@@ -1415,7 +1415,7 @@ static BOOL update_send_cache_bitmap_v2(rdpContext* context,
                                         CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
 {
        wStream* s;
-       int bm, em;
+       size_t bm, em;
        BYTE orderType;
        int headerLength;
        UINT16 extraFlags;
@@ -1465,7 +1465,7 @@ static BOOL update_send_cache_bitmap_v3(rdpContext* context,
                                         CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
 {
        wStream* s;
-       int bm, em;
+       size_t bm, em;
        BYTE orderType;
        int headerLength;
        UINT16 extraFlags;
@@ -1510,7 +1510,7 @@ static BOOL update_send_cache_color_table(rdpContext* context,
 {
        wStream* s;
        UINT16 flags;
-       int bm, em, inf;
+       size_t bm, em, inf;
        int headerLength;
        INT16 orderLength;
        rdpUpdate* update = context->update;
@@ -1551,7 +1551,7 @@ static BOOL update_send_cache_glyph(rdpContext* context,
 {
        wStream* s;
        UINT16 flags;
-       int bm, em, inf;
+       size_t bm, em, inf;
        int headerLength;
        INT16 orderLength;
        rdpUpdate* update = context->update;
@@ -1592,7 +1592,7 @@ static BOOL update_send_cache_glyph_v2(rdpContext* context,
 {
        wStream* s;
        UINT16 flags;
-       int bm, em, inf;
+       size_t bm, em, inf;
        int headerLength;
        INT16 orderLength;
        rdpUpdate* update = context->update;
@@ -1618,8 +1618,7 @@ static BOOL update_send_cache_glyph_v2(rdpContext* context,
        em = Stream_GetPosition(s);
        orderLength = (em - bm) - 13;
        Stream_SetPosition(s, bm);
-       Stream_Write_UINT8(s, ORDER_STANDARD |
-                          ORDER_SECONDARY); /* controlFlags (1 byte) */
+       Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY); /* controlFlags (1 byte) */
        Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
        Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
        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;
        UINT16 flags;
-       int bm, em, inf;
+       size_t bm, em, inf;
        int headerLength;
        INT16 orderLength;
        rdpUpdate* update = context->update;
@@ -1678,7 +1677,7 @@ static BOOL update_send_create_offscreen_bitmap_order(
     const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
 {
        wStream* s;
-       int bm, em, inf;
+       size_t bm, em, inf;
        BYTE orderType;
        BYTE controlFlags;
        int headerLength;
@@ -1717,7 +1716,7 @@ static BOOL update_send_switch_surface_order(
     const SWITCH_SURFACE_ORDER* switch_surface)
 {
        wStream* s;
-       int bm, em, inf;
+       size_t bm, em, inf;
        BYTE orderType;
        BYTE controlFlags;
        int headerLength;
index 96e8e96..b5d7fe3 100644 (file)
@@ -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)
 {
        wStream* s;
-       int length;
+       size_t length;
        NTLM_NEGOTIATE_MESSAGE* message;
        message = &context->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)
 {
        wStream* s;
-       int length;
+       size_t length;
        NTLM_NEGOTIATE_MESSAGE* message;
        message = &context->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)
 {
        wStream* s;
-       int length;
+       size_t length;
        UINT32 PayloadOffset;
        NTLM_CHALLENGE_MESSAGE* 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)
 {
        wStream* s;
-       int length;
+       size_t length;
        UINT32 flags;
        NTLM_AV_PAIR* AvFlags;
        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)
 {
        wStream* s;
-       int length;
+       size_t length;
        UINT32 PayloadBufferOffset;
        NTLM_AUTHENTICATE_MESSAGE* message;
        SSPI_CREDENTIALS* credentials = context->credentials;
index ded6157..2ee04c4 100644 (file)
@@ -2,7 +2,7 @@
 #include <winpr/print.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)
        {