[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 committed by akallabeth
parent 6bdd36c83d
commit a332db7cf5
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])
return -6001; /* error */
*((UINT16*)OutputBuffer) = MatchCount;
Data_Write_UINT16(OutputBuffer, MatchCount);
MatchDetails = (RDP61_MATCH_DETAILS*)&OutputBuffer[2];
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++)
{
MatchDetails[MatchIndex].MatchLength =
(UINT16)(xcrush->OptimizedMatches[MatchIndex].MatchLength);
MatchDetails[MatchIndex].MatchOutputOffset =
(UINT16)(xcrush->OptimizedMatches[MatchIndex].MatchOffset - HistoryOffset);
MatchDetails[MatchIndex].MatchHistoryOffset =
xcrush->OptimizedMatches[MatchIndex].ChunkOffset;
Data_Write_UINT16(&MatchDetails[MatchIndex].MatchLength,
xcrush->OptimizedMatches[MatchIndex].MatchLength);
Data_Write_UINT16(&MatchDetails[MatchIndex].MatchOutputOffset,
xcrush->OptimizedMatches[MatchIndex].MatchOffset - HistoryOffset);
Data_Write_UINT32(&MatchDetails[MatchIndex].MatchHistoryOffset,
xcrush->OptimizedMatches[MatchIndex].ChunkOffset);
}
CurrentOffset = HistoryOffset;

View File

@ -574,7 +574,7 @@ BOOL WTSVirtualChannelManagerOpen(HANDLE hServer)
{
ULONG written;
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))
return FALSE;