rail_common.c: Fix rail_get_order_type_string

(cherry picked from commit 5438b94c979728feeccd13374c77c4881eda8137)
This commit is contained in:
Kobi Mizrachi 2020-07-06 08:37:14 +03:00 committed by Armin Novak
parent 7f10a9261c
commit cf6be7f6d4
2 changed files with 7 additions and 4 deletions

View File

@ -51,9 +51,13 @@ static const char* const RAIL_ORDER_TYPE_STRINGS[] = { "",
"",
"" };
const char* rail_get_order_type_string(BYTE orderType)
const char* rail_get_order_type_string(UINT16 orderType)
{
return RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)];
UINT32 index = ((orderType & 0xF0) >> 3) + (orderType & 0x0F);
if (index >= ARRAYSIZE(RAIL_ORDER_TYPE_STRINGS))
return "UNKNOWN";
return RAIL_ORDER_TYPE_STRINGS[index];
}
/**

View File

@ -26,8 +26,6 @@
#include <freerdp/rail.h>
const char* rail_get_order_type_string(BYTE orderType);
#define RAIL_PDU_HEADER_LENGTH 4
/* Fixed length of PDUs, excluding variable lengths */
@ -72,5 +70,6 @@ UINT rail_read_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam, BOOL ex
UINT rail_write_sysparam_order(wStream* s, const RAIL_SYSPARAM_ORDER* sysparam,
BOOL extendedSpiSupported);
BOOL rail_is_extended_spi_supported(UINT32 channelsFlags);
const char* rail_get_order_type_string(UINT16 orderType);
#endif /* FREERDP_CHANNEL_RAIL_COMMON_H */