mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Allow data size of zero for data length checks if protocol version is 4 or lower, this is to fix backwards compatibility with a bug in older versions OpenRGB.NET that has since been fixed.
This commit is contained in:
@@ -688,8 +688,15 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
/*---------------------------------------------------------*\
|
||||
| Verify the color description size (first 4 bytes of data) |
|
||||
| matches the packet size in the header |
|
||||
| |
|
||||
| If protocol version is 4 or below, allow the description |
|
||||
| size to be zero. This allows backwards compatibility with|
|
||||
| versions of the OpenRGB.NET SDK implementation which had |
|
||||
| a bug where this field would always be zero. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(header.pkt_size == *((unsigned int*)data))
|
||||
if((header.pkt_size == *((unsigned int*)data))
|
||||
|| ((client_info->client_protocol_version <= 4)
|
||||
&& (*((unsigned int*)data) == 0)))
|
||||
{
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
@@ -713,8 +720,15 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
/*---------------------------------------------------------*\
|
||||
| Verify the color description size (first 4 bytes of data) |
|
||||
| matches the packet size in the header |
|
||||
| |
|
||||
| If protocol version is 4 or below, allow the description |
|
||||
| size to be zero. This allows backwards compatibility with|
|
||||
| versions of the OpenRGB.NET SDK implementation which had |
|
||||
| a bug where this field would always be zero. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(header.pkt_size == *((unsigned int*)data))
|
||||
if((header.pkt_size == *((unsigned int*)data))
|
||||
|| ((client_info->client_protocol_version <= 4)
|
||||
&& (*((unsigned int*)data) == 0)))
|
||||
{
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
@@ -778,8 +792,15 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
/*---------------------------------------------------------*\
|
||||
| Verify the mode description size (first 4 bytes of data) |
|
||||
| matches the packet size in the header |
|
||||
| |
|
||||
| If protocol version is 4 or below, allow the description |
|
||||
| size to be zero. This allows backwards compatibility with|
|
||||
| versions of the OpenRGB.NET SDK implementation which had |
|
||||
| a bug where this field would always be zero. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(header.pkt_size == *((unsigned int*)data))
|
||||
if((header.pkt_size == *((unsigned int*)data))
|
||||
|| ((client_info->client_protocol_version <= 4)
|
||||
&& (*((unsigned int*)data) == 0)))
|
||||
{
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
@@ -803,8 +824,15 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
/*---------------------------------------------------------*\
|
||||
| Verify the mode description size (first 4 bytes of data) |
|
||||
| matches the packet size in the header |
|
||||
| |
|
||||
| If protocol version is 4 or below, allow the description |
|
||||
| size to be zero. This allows backwards compatibility with|
|
||||
| versions of the OpenRGB.NET SDK implementation which had |
|
||||
| a bug where this field would always be zero. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(header.pkt_size == *((unsigned int*)data))
|
||||
if((header.pkt_size == *((unsigned int*)data))
|
||||
|| ((client_info->client_protocol_version <= 4)
|
||||
&& (*((unsigned int*)data) == 0)))
|
||||
{
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user