be sure to copy not too much data to buf

This commit is contained in:
Gerhard Hoffmann 2024-06-27 13:23:15 +02:00
parent dda9e4ad8f
commit 91ce1c84d8

View File

@ -14,6 +14,7 @@ History:
#include <QDir>
#include <algorithm> // min/max
@ -1048,7 +1049,7 @@ char T_datif::loadRecDataFromFrame()
// only use as many bytes as maximally possible
char buf[sizeof(struct T_dynamicCondition)];
memset(buf, 0, sizeof(buf));
memcpy(buf, receivedData, sizeof(struct T_dynamicCondition));
memcpy(buf, receivedData, std::min(sizeof(receivedData), sizeof(struct T_dynamicCondition)));
gpi_storeDynMachineConditions(buf);
} else {
gpi_storeDynMachineConditions(receivedData);