[channels,cliprdr] improve casts

This commit is contained in:
Armin Novak
2025-08-18 14:11:35 +02:00
parent 7b7cc538dd
commit c7c7874bf0

View File

@@ -66,14 +66,16 @@ static UINT cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
WINPR_ASSERT(s);
const size_t pos = Stream_GetPosition(s);
const size_t dataLen = pos - 8ULL;
WINPR_ASSERT(dataLen <= UINT32_MAX);
WINPR_ASSERT(pos >= 8ULL);
WINPR_ASSERT(pos <= UINT32_MAX - 8);
const uint32_t dataLen = WINPR_ASSERTING_INT_CAST(uint32_t, pos - 8UL);
Stream_SetPosition(s, 4);
Stream_Write_UINT32(s, (UINT32)dataLen);
Stream_Write_UINT32(s, dataLen);
Stream_SetPosition(s, pos);
WLog_Print(cliprdr->log, WLOG_DEBUG, "Cliprdr Sending (%" PRIuz " bytes)", dataLen + 8UL);
WLog_Print(cliprdr->log, WLOG_DEBUG, "Cliprdr Sending (%" PRIuz " bytes)", pos);
if (!cliprdr)
{