Merge pull request #551 from tekka007/StreamLength
Limit payload size to MAX_PAYLOAD
This commit is contained in:
+3
-2
@@ -210,9 +210,10 @@ MyMessage& MyMessage::setDestination(uint8_t _destination) {
|
|||||||
|
|
||||||
// Set payload
|
// Set payload
|
||||||
MyMessage& MyMessage::set(void* value, uint8_t length) {
|
MyMessage& MyMessage::set(void* value, uint8_t length) {
|
||||||
|
uint8_t payloadLength = value == NULL ? 0 : min(length, MAX_PAYLOAD);
|
||||||
|
miSetLength(payloadLength);
|
||||||
miSetPayloadType(P_CUSTOM);
|
miSetPayloadType(P_CUSTOM);
|
||||||
miSetLength(length);
|
memcpy(data, value, payloadLength);
|
||||||
memcpy(data, value, min(length, MAX_PAYLOAD));
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user