Fix string length problem reported by EasyIoT

This commit is contained in:
Henrik Ekblad
2015-01-16 12:05:09 +01:00
parent 6cb3c98014
commit 4796487809
+2 -2
View File
@@ -177,10 +177,10 @@ MyMessage& MyMessage::set(void* value, uint8_t length) {
MyMessage& MyMessage::set(const char* value) {
uint8_t length = strlen(value);
uint8_t length = min(strlen(value), MAX_PAYLOAD);
miSetLength(length);
miSetPayloadType(P_STRING);
strncpy(data, value, min(length, MAX_PAYLOAD));
strncpy(data, value, length);
return *this;
}