[stream] use const correct Stream_Pointer access

This commit is contained in:
Armin Novak
2023-06-07 15:38:21 +02:00
committed by David Fort
parent 2de7399e52
commit 970f0c54e8
54 changed files with 172 additions and 198 deletions

View File

@@ -690,7 +690,7 @@ static UINT remdesk_process_receive(remdeskPlugin* remdesk, wStream* s)
#if 0
WLog_DBG(TAG, "RemdeskReceive: %"PRIuz"", Stream_GetRemainingLength(s));
winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s));
winpr_HexDump(Stream_ConstPointer(s), Stream_GetRemainingLength(s));
#endif
if ((status = remdesk_read_channel_header(s, &header)))

View File

@@ -257,17 +257,13 @@ static UINT remdesk_recv_ctl_version_info_pdu(RemdeskServerContext* context, wSt
static UINT remdesk_recv_ctl_remote_control_desktop_pdu(RemdeskServerContext* context, wStream* s,
REMDESK_CHANNEL_HEADER* header)
{
SSIZE_T cchStringW;
WCHAR* pStringW;
UINT32 msgLength;
SSIZE_T cchStringW = 0;
SSIZE_T cbRaConnectionStringW = 0;
WCHAR* raConnectionStringW = NULL;
REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu;
UINT error;
msgLength = header->DataLength - 4;
pStringW = (WCHAR*)Stream_Pointer(s);
raConnectionStringW = pStringW;
cchStringW = 0;
REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu = { 0 };
UINT error = 0;
UINT32 msgLength = header->DataLength - 4;
const WCHAR* pStringW = Stream_ConstPointer(s);
const WCHAR* raConnectionStringW = pStringW;
while ((msgLength > 0) && pStringW[cchStringW])
{
@@ -302,18 +298,15 @@ static UINT remdesk_recv_ctl_remote_control_desktop_pdu(RemdeskServerContext* co
static UINT remdesk_recv_ctl_authenticate_pdu(RemdeskServerContext* context, wStream* s,
REMDESK_CHANNEL_HEADER* header)
{
int cchStringW;
WCHAR* pStringW;
UINT32 msgLength;
int cchStringW = 0;
UINT32 msgLength = 0;
int cbExpertBlobW = 0;
WCHAR* expertBlobW = NULL;
const WCHAR* expertBlobW = NULL;
int cbRaConnectionStringW = 0;
WCHAR* raConnectionStringW = NULL;
REMDESK_CTL_AUTHENTICATE_PDU pdu;
REMDESK_CTL_AUTHENTICATE_PDU pdu = { 0 };
msgLength = header->DataLength - 4;
pStringW = (WCHAR*)Stream_Pointer(s);
raConnectionStringW = pStringW;
cchStringW = 0;
const WCHAR* pStringW = Stream_ConstPointer(s);
const WCHAR* raConnectionStringW = pStringW;
while ((msgLength > 0) && pStringW[cchStringW])
{
@@ -368,14 +361,13 @@ static UINT remdesk_recv_ctl_verify_password_pdu(RemdeskServerContext* context,
REMDESK_CHANNEL_HEADER* header)
{
SSIZE_T cbExpertBlobW = 0;
WCHAR* expertBlobW = NULL;
REMDESK_CTL_VERIFY_PASSWORD_PDU pdu;
UINT error;
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
return ERROR_INVALID_DATA;
expertBlobW = (WCHAR*)Stream_Pointer(s);
const WCHAR* expertBlobW = Stream_ConstPointer(s);
cbExpertBlobW = header->DataLength - 4;
pdu.expertBlob = ConvertWCharNToUtf8Alloc(expertBlobW, cbExpertBlobW / sizeof(WCHAR), NULL);
@@ -489,7 +481,7 @@ static UINT remdesk_server_receive_pdu(RemdeskServerContext* context, wStream* s
REMDESK_CHANNEL_HEADER header;
#if 0
WLog_INFO(TAG, "RemdeskReceive: %"PRIuz"", Stream_GetRemainingLength(s));
winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s));
winpr_HexDump(WCHAR* expertBlobW = NULL;(s), Stream_GetRemainingLength(s));
#endif
if ((error = remdesk_read_channel_header(s, &header)))