Skip to content

Commit

Permalink
Zero byte instead of zero integer
Browse files Browse the repository at this point in the history
This is a really good suggestion from @WSchimi in #6 
Thanks!
  • Loading branch information
pinae authored Nov 26, 2021
1 parent b1cc132 commit 2e03894
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ char* createFullTopicStr(const char* topic) {
strncpy(fullTopicStr, deviceName, strlen(deviceName));
strncpy(fullTopicStr+strlen(deviceName), "/", 1);
strncpy(fullTopicStr+strlen(deviceName)+1, topic, strlen(topic));
*(fullTopicStr + topicLen+1) = 0;
*(fullTopicStr + topicLen+1) = \0;
return fullTopicStr;
}

Expand Down Expand Up @@ -147,4 +147,4 @@ void mqttLoop() {
connectToMqtt(savedSubscriptionCallback);
}
mqttClient.loop();
}
}

0 comments on commit 2e03894

Please sign in to comment.