diff --git a/channels/rail/rail_common.c b/channels/rail/rail_common.c index 902a738c5..b6d69b799 100644 --- a/channels/rail/rail_common.c +++ b/channels/rail/rail_common.c @@ -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]; } /** diff --git a/channels/rail/rail_common.h b/channels/rail/rail_common.h index 6d411ebb1..e13412df9 100644 --- a/channels/rail/rail_common.h +++ b/channels/rail/rail_common.h @@ -26,8 +26,6 @@ #include -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 */