From 59550410a3f55f11b39aacfcaaa2dd8926682673 Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Sun, 7 Feb 2016 12:48:36 +0100 Subject: [PATCH] Add NULL termination to payloads Messages addressed to "this" node, will have a null char appended to the payload after message verification is done, because some "getters" assume the message being a string. --- libraries/MySensors/MySensor.cpp | 1 + libraries/MySensors/Version.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/MySensors/MySensor.cpp b/libraries/MySensors/MySensor.cpp index b87a4c4..6e85c54 100644 --- a/libraries/MySensors/MySensor.cpp +++ b/libraries/MySensors/MySensor.cpp @@ -620,6 +620,7 @@ boolean MySensor::process() { if (destination == nc.nodeId) { // This message is addressed to this node mSetSigned(msg,0); + msg.data[mGetLength(msg)] = '\0'; // Add NULL termination so that "getters" works as expected if (repeaterMode && last != nc.parentNodeId) { // Message is from one of the child nodes. Add it to routing table. diff --git a/libraries/MySensors/Version.h b/libraries/MySensors/Version.h index 79efa67..bb45df0 100644 --- a/libraries/MySensors/Version.h +++ b/libraries/MySensors/Version.h @@ -6,6 +6,6 @@ #ifndef Version_h #define Version_h -#define LIBRARY_VERSION "1.5.3" +#define LIBRARY_VERSION "1.5.4" #endif