[channels,rdpei] fix integer narrow

This commit is contained in:
akallabeth 2024-09-25 03:42:15 +02:00
parent 15141385f6
commit 911ed13efc
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -93,7 +93,7 @@ BOOL rdpei_read_2byte_signed(wStream* s, INT16* value)
negative = (byte & 0x40) ? TRUE : FALSE; negative = (byte & 0x40) ? TRUE : FALSE;
*value = (byte & 0x3F); const BYTE val = (byte & 0x3F);
if (byte & 0x80) if (byte & 0x80)
{ {
@ -101,8 +101,10 @@ BOOL rdpei_read_2byte_signed(wStream* s, INT16* value)
return FALSE; return FALSE;
Stream_Read_UINT8(s, byte); Stream_Read_UINT8(s, byte);
*value = ((*value & 0xFF) << 8) | byte; *value = (INT16)((val << 8) | byte);
} }
else
*value = val;
if (negative) if (negative)
*value *= -1; *value *= -1;