Fixed Stream API misuse.

This commit is contained in:
Armin Novak 2016-02-25 20:01:12 +01:00
parent b61ab5ecb7
commit e79eee2bb1
8 changed files with 17 additions and 18 deletions

View File

@ -3392,10 +3392,10 @@ BOOL rdp_print_capability_sets(wStream* s, UINT16 numberCapabilities, BOOL recei
break;
}
if (s->pointer != em)
if (Stream_Pointer(s) != em)
{
WLog_ERR(TAG, "incorrect offset, type:0x%02X actual:%d expected:%d",
type, (int)(s->pointer - bm), (int)(em - bm));
type, (int)(Stream_Pointer(s) - bm), (int)(em - bm));
}
Stream_SetPointer(s, em);
@ -3617,10 +3617,10 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
}
}
if (s->pointer != em)
if (Stream_Pointer(s) != em)
{
WLog_ERR(TAG, "incorrect offset, type:0x%02X actual:%d expected:%d",
type, (int)(s->pointer - bm), (int)(em - bm));
type, (int)(Stream_Pointer(s) - bm), (int)(em - bm));
}
Stream_SetPointer(s, em);

View File

@ -407,7 +407,7 @@ wStream* http_request_write(HttpContext* context, HttpRequest* request)
free(lines);
Stream_Write(s, "\0", 1); /* append null terminator */
Stream_Rewind(s, 1); /* don't include null terminator in length */
Stream_Length(s) = Stream_GetPosition(s);
Stream_SetLength(s, Stream_GetPosition(s));
return s;
out_free:

View File

@ -225,7 +225,7 @@ void gcc_write_conference_create_request(wStream* s, wStream* userData)
per_write_octet_string(s, h221_cs_key, 4, 4); /* h221NonStandard, client-to-server H.221 key, "Duca" */
/* userData::value (OCTET_STRING) */
per_write_octet_string(s, userData->buffer, Stream_GetPosition(userData), 0); /* array of client data blocks */
per_write_octet_string(s, Stream_Buffer(userData), Stream_GetPosition(userData), 0); /* array of client data blocks */
}
BOOL gcc_read_conference_create_response(wStream* s, rdpMcs* mcs)
@ -319,7 +319,7 @@ void gcc_write_conference_create_response(wStream* s, wStream* userData)
per_write_octet_string(s, h221_sc_key, 4, 4); /* h221NonStandard, server-to-client H.221 key, "McDn" */
/* userData (OCTET_STRING) */
per_write_octet_string(s, userData->buffer, Stream_GetPosition(userData), 0); /* array of server data blocks */
per_write_octet_string(s, Stream_Buffer(userData), Stream_GetPosition(userData), 0); /* array of server data blocks */
}
BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
@ -508,7 +508,7 @@ BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length)
break;
}
offset += blockLength;
Stream_Pointer(s) = holdp + blockLength;
Stream_SetPointer(s, holdp + blockLength);
}
return TRUE;

View File

@ -571,7 +571,7 @@ BOOL mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* userData)
goto out;
/* userData (OCTET_STRING) */
ber_write_octet_string(tmps, userData->buffer, Stream_GetPosition(userData));
ber_write_octet_string(tmps, Stream_Buffer(userData), Stream_GetPosition(userData));
length = Stream_GetPosition(tmps);
/* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */
@ -608,7 +608,7 @@ BOOL mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData)
if (!mcs_write_domain_parameters(tmps, &(mcs->domainParameters)))
goto out;
/* userData (OCTET_STRING) */
ber_write_octet_string(tmps, userData->buffer, Stream_GetPosition(userData));
ber_write_octet_string(tmps, Stream_Buffer(userData), Stream_GetPosition(userData));
length = Stream_GetPosition(tmps);
ber_write_application_tag(s, MCS_TYPE_CONNECT_RESPONSE, length);

View File

@ -1728,7 +1728,7 @@ BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_
}
}
Stream_Pointer(s) = phold + fastGlyph->cbData;
Stream_SetPointer(s, phold + fastGlyph->cbData);
}
return TRUE;
@ -3546,7 +3546,7 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break;
}
Stream_Pointer(s) = next;
Stream_SetPointer(s, next);
return TRUE;
}

View File

@ -1056,7 +1056,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
return FALSE; /* TODO */
}
Stream_Length(s) -= pad;
Stream_SetLength(s, Stream_Length(s) - pad);
return TRUE;
}

View File

@ -733,8 +733,7 @@ out_cleanup:
transport->layer = TRANSPORT_LAYER_CLOSED;
}
if (s->pool)
Stream_Release(s);
Stream_Release(s);
LeaveCriticalSection(&(transport->WriteLock));
return status;

View File

@ -449,12 +449,12 @@ BOOL tf_peer_dump_rfx(freerdp_peer* client)
if (!tmp)
break;
Stream_Buffer(s) = tmp;
Stream_SetBuffer(s, tmp);
record.data = Stream_Buffer(s);
Stream_Capacity(s) = record.length;
Stream_SetCapacity(s, record.length);
pcap_get_next_record_content(pcap_rfx, &record);
Stream_Pointer(s) = Stream_Buffer(s) + Stream_Capacity(s);
Stream_SetPointer(s, Stream_Buffer(s) + Stream_Capacity(s));
if (test_dump_rfx_realtime && test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == FALSE)
break;