[libfreerdp] fix endianness issues

There were some fields sent without considering endianness, making the
clients fail when parsing those fields.

Use Data_Write_XXX functions so the endiannes won't affect the byte order
and the clients will read properly the fields.
This commit is contained in:
Joan Torres 2023-07-31 19:01:31 +02:00
parent 10386e73bc
commit 8d6c27ba10
2 changed files with 8 additions and 8 deletions

View File

@ -694,7 +694,7 @@ static int xcrush_generate_output(XCRUSH_CONTEXT* xcrush, BYTE* OutputBuffer, UI
if (&OutputBuffer[2] >= &OutputBuffer[OutputSize]) if (&OutputBuffer[2] >= &OutputBuffer[OutputSize])
return -6001; /* error */ return -6001; /* error */
*((UINT16*)OutputBuffer) = MatchCount; Data_Write_UINT16(OutputBuffer, MatchCount);
MatchDetails = (RDP61_MATCH_DETAILS*)&OutputBuffer[2]; MatchDetails = (RDP61_MATCH_DETAILS*)&OutputBuffer[2];
Literals = (BYTE*)&MatchDetails[MatchCount]; Literals = (BYTE*)&MatchDetails[MatchCount];
@ -703,12 +703,12 @@ static int xcrush_generate_output(XCRUSH_CONTEXT* xcrush, BYTE* OutputBuffer, UI
for (MatchIndex = 0; MatchIndex < MatchCount; MatchIndex++) for (MatchIndex = 0; MatchIndex < MatchCount; MatchIndex++)
{ {
MatchDetails[MatchIndex].MatchLength = Data_Write_UINT16(&MatchDetails[MatchIndex].MatchLength,
(UINT16)(xcrush->OptimizedMatches[MatchIndex].MatchLength); xcrush->OptimizedMatches[MatchIndex].MatchLength);
MatchDetails[MatchIndex].MatchOutputOffset = Data_Write_UINT16(&MatchDetails[MatchIndex].MatchOutputOffset,
(UINT16)(xcrush->OptimizedMatches[MatchIndex].MatchOffset - HistoryOffset); xcrush->OptimizedMatches[MatchIndex].MatchOffset - HistoryOffset);
MatchDetails[MatchIndex].MatchHistoryOffset = Data_Write_UINT32(&MatchDetails[MatchIndex].MatchHistoryOffset,
xcrush->OptimizedMatches[MatchIndex].ChunkOffset; xcrush->OptimizedMatches[MatchIndex].ChunkOffset);
} }
CurrentOffset = HistoryOffset; CurrentOffset = HistoryOffset;

View File

@ -574,7 +574,7 @@ BOOL WTSVirtualChannelManagerOpen(HANDLE hServer)
{ {
ULONG written; ULONG written;
vcm->drdynvc_channel = channel; vcm->drdynvc_channel = channel;
dynvc_caps = 0x00010050; /* DYNVC_CAPS_VERSION1 (4 bytes) */ Data_Write_UINT32(&dynvc_caps, 0x00010050); /* DYNVC_CAPS_VERSION1 (4 bytes) */
if (!WTSVirtualChannelWrite(channel, (PCHAR)&dynvc_caps, sizeof(dynvc_caps), &written)) if (!WTSVirtualChannelWrite(channel, (PCHAR)&dynvc_caps, sizeof(dynvc_caps), &written))
return FALSE; return FALSE;