mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr,endianess] replace usage of Data_Read_*
Use new and improved winpr_Data_Get_*
This commit is contained in:
@@ -847,7 +847,7 @@ static int xcrush_decompress_l1(XCRUSH_CONTEXT* WINPR_RESTRICT xcrush,
|
||||
if ((pSrcData + 2) > pSrcEnd)
|
||||
return -1003;
|
||||
|
||||
Data_Read_UINT16(pSrcData, MatchCount);
|
||||
MatchCount = winpr_Data_Get_UINT16(pSrcData);
|
||||
MatchDetails = (const RDP61_MATCH_DETAILS*)&pSrcData[2];
|
||||
Literals = (const BYTE*)&MatchDetails[MatchCount];
|
||||
OutputOffset = 0;
|
||||
@@ -857,9 +857,10 @@ static int xcrush_decompress_l1(XCRUSH_CONTEXT* WINPR_RESTRICT xcrush,
|
||||
|
||||
for (MatchIndex = 0; MatchIndex < MatchCount; MatchIndex++)
|
||||
{
|
||||
Data_Read_UINT16(&MatchDetails[MatchIndex].MatchLength, MatchLength);
|
||||
Data_Read_UINT16(&MatchDetails[MatchIndex].MatchOutputOffset, MatchOutputOffset);
|
||||
Data_Read_UINT32(&MatchDetails[MatchIndex].MatchHistoryOffset, MatchHistoryOffset);
|
||||
MatchLength = winpr_Data_Get_UINT16(&MatchDetails[MatchIndex].MatchLength);
|
||||
MatchOutputOffset = winpr_Data_Get_UINT16(&MatchDetails[MatchIndex].MatchOutputOffset);
|
||||
MatchHistoryOffset =
|
||||
winpr_Data_Get_UINT32(&MatchDetails[MatchIndex].MatchHistoryOffset);
|
||||
|
||||
if (MatchOutputOffset < OutputOffset)
|
||||
return -1005;
|
||||
|
||||
@@ -532,11 +532,9 @@ DWORD CharUpperBuffA(LPSTR lpsz, DWORD cchLength)
|
||||
|
||||
DWORD CharUpperBuffW(LPWSTR lpsz, DWORD cchLength)
|
||||
{
|
||||
WCHAR value = 0;
|
||||
|
||||
for (DWORD i = 0; i < cchLength; i++)
|
||||
{
|
||||
Data_Read_UINT16(&lpsz[i], value);
|
||||
WCHAR value = winpr_Data_Get_UINT16(&lpsz[i]);
|
||||
value = WINPR_TOUPPERW(value);
|
||||
Data_Write_UINT16(&lpsz[i], value);
|
||||
}
|
||||
@@ -601,11 +599,9 @@ DWORD CharLowerBuffA(LPSTR lpsz, DWORD cchLength)
|
||||
|
||||
DWORD CharLowerBuffW(LPWSTR lpsz, DWORD cchLength)
|
||||
{
|
||||
WCHAR value = 0;
|
||||
|
||||
for (DWORD i = 0; i < cchLength; i++)
|
||||
{
|
||||
Data_Read_UINT16(&lpsz[i], value);
|
||||
WCHAR value = winpr_Data_Get_UINT16(&lpsz[i]);
|
||||
value = WINPR_TOLOWERW(value);
|
||||
Data_Write_UINT16(&lpsz[i], value);
|
||||
}
|
||||
|
||||
@@ -1925,11 +1925,11 @@ static SECURITY_STATUS SEC_ENTRY kerberos_DecryptMessage(PCtxtHandle phContext,
|
||||
|
||||
/* Read in header information */
|
||||
header = sig_buffer->pvBuffer;
|
||||
Data_Read_UINT16_BE(header, tok_id);
|
||||
tok_id = winpr_Data_Get_UINT16_BE(header);
|
||||
flags = header[2];
|
||||
Data_Read_UINT16_BE((header + 4), ec);
|
||||
Data_Read_UINT16_BE((header + 6), rrc);
|
||||
Data_Read_UINT64_BE((header + 8), seq_no);
|
||||
ec = winpr_Data_Get_UINT16_BE((header + 4));
|
||||
rrc = winpr_Data_Get_UINT16_BE((header + 6));
|
||||
seq_no = winpr_Data_Get_UINT64_BE((header + 8));
|
||||
|
||||
/* Check that the header is valid */
|
||||
if (tok_id != TOK_ID_WRAP || (BYTE)header[3] != 0xFF)
|
||||
@@ -2096,9 +2096,9 @@ static SECURITY_STATUS SEC_ENTRY kerberos_VerifySignature(PCtxtHandle phContext,
|
||||
|
||||
/* Read in header info */
|
||||
header = sig_buffer->pvBuffer;
|
||||
Data_Read_UINT16_BE(header, tok_id);
|
||||
tok_id = winpr_Data_Get_UINT16_BE(header);
|
||||
flags = header[2];
|
||||
Data_Read_UINT64_BE((header + 8), seq_no);
|
||||
seq_no = winpr_Data_Get_UINT64_BE((header + 8));
|
||||
|
||||
/* Validate header */
|
||||
if (tok_id != TOK_ID_MIC)
|
||||
|
||||
@@ -114,7 +114,7 @@ BOOL krb5glue_authenticator_validate_chksum(krb5glue_authenticator authenticator
|
||||
if (!authenticator || !authenticator->checksum ||
|
||||
authenticator->checksum->checksum_type != cksumtype || authenticator->checksum->length < 24)
|
||||
return FALSE;
|
||||
Data_Read_UINT32((authenticator->checksum->contents + 20), (*flags));
|
||||
*flags = winpr_Data_Get_UINT32((authenticator->checksum->contents + 20));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,14 +109,13 @@ static BOOL ntlm_av_pair_list_init(NTLM_AV_PAIR* pAvPairList, size_t cbAvPairLis
|
||||
|
||||
static INLINE BOOL ntlm_av_pair_get_id(const NTLM_AV_PAIR* pAvPair, size_t size, UINT16* pair)
|
||||
{
|
||||
UINT16 AvId = 0;
|
||||
if (!pAvPair || !pair)
|
||||
return FALSE;
|
||||
|
||||
if (size < sizeof(NTLM_AV_PAIR))
|
||||
return FALSE;
|
||||
|
||||
Data_Read_UINT16(&pAvPair->AvId, AvId);
|
||||
const UINT16 AvId = winpr_Data_Get_UINT16(&pAvPair->AvId);
|
||||
|
||||
*pair = AvId;
|
||||
return TRUE;
|
||||
@@ -142,14 +141,13 @@ ULONG ntlm_av_pair_list_length(NTLM_AV_PAIR* pAvPairList, size_t cbAvPairList)
|
||||
|
||||
static INLINE BOOL ntlm_av_pair_get_len(const NTLM_AV_PAIR* pAvPair, size_t size, size_t* pAvLen)
|
||||
{
|
||||
UINT16 AvLen = 0;
|
||||
if (!pAvPair)
|
||||
return FALSE;
|
||||
|
||||
if (size < sizeof(NTLM_AV_PAIR))
|
||||
return FALSE;
|
||||
|
||||
Data_Read_UINT16(&pAvPair->AvLen, AvLen);
|
||||
const UINT16 AvLen = winpr_Data_Get_UINT16(&pAvPair->AvLen);
|
||||
|
||||
*pAvLen = AvLen;
|
||||
return TRUE;
|
||||
|
||||
@@ -1040,7 +1040,7 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer
|
||||
context->NTLMv2Response.Challenge.cbAvPairs, MsvAvFlags, &cbAvFlags);
|
||||
|
||||
if (AvFlags)
|
||||
Data_Read_UINT32(ntlm_av_pair_get_value_pointer(AvFlags), flags);
|
||||
flags = winpr_Data_Get_UINT32(ntlm_av_pair_get_value_pointer(AvFlags));
|
||||
}
|
||||
|
||||
if (!ntlm_read_message_fields_buffer(
|
||||
|
||||
Reference in New Issue
Block a user