Add a size check to the client on controller data receiving
This commit is contained in:
parent
64a0d2c061
commit
44268596b3
1 changed files with 27 additions and 20 deletions
|
|
@ -556,8 +556,14 @@ void NetworkClient::ProcessReply_ControllerCount(unsigned int data_size, char *
|
|||
}
|
||||
}
|
||||
|
||||
void NetworkClient::ProcessReply_ControllerData(unsigned int /*data_size*/, char * data, unsigned int dev_idx)
|
||||
void NetworkClient::ProcessReply_ControllerData(unsigned int data_size, char * data, unsigned int dev_idx)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Verify the controller description size (first 4 bytes of |
|
||||
| data) matches the packet size in the header |
|
||||
\*---------------------------------------------------------*/
|
||||
if(data_size == *((unsigned int*)data))
|
||||
{
|
||||
RGBController_Network * new_controller = new RGBController_Network(this, dev_idx);
|
||||
|
||||
new_controller->ReadDeviceDescription((unsigned char *)data, GetProtocolVersion());
|
||||
|
|
@ -581,6 +587,7 @@ void NetworkClient::ProcessReply_ControllerData(unsigned int /*data_size*/, char
|
|||
ControllerListMutex.unlock();
|
||||
|
||||
controller_data_received = true;
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkClient::ProcessReply_ProtocolVersion(unsigned int data_size, char * data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue