From 2f6051f61e62ac477622f02708cb8eb13bc0ca51 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sat, 03 Aug 2019 18:18:49 +0800
Subject: [PATCH] update mqttd main.c, fix debug with java bug for JSON with \0 bug

---
 mqttd/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mqttd/main.c b/mqttd/main.c
index 1692422..488c7e7 100644
--- a/mqttd/main.c
+++ b/mqttd/main.c
@@ -275,7 +275,7 @@
         else 
             snprintf(msg, sizeof(msg), "{ \"id\":%s, \"temp\":\"%.2f\" }", ctx->id, temp);
 
-        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg)+1, msg, ctx->pubQos, retain);
+        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg), msg, ctx->pubQos, retain);
         if( rv )
         {
             log_err("Publisher broadcast message '%s' failure: %d\n", msg, rv);
@@ -295,7 +295,7 @@
         else 
             snprintf(msg, sizeof(msg), "{ \"id\":%s, \"temp\":\"%.2f\", \"RH\":\"%.2f\" }", ctx->id, temp, rh);
 
-        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg)+1, msg, ctx->pubQos, retain);
+        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg), msg, ctx->pubQos, retain);
         if( rv )
         {
             log_err("Publisher broadcast message '%s' failure: %d\n", msg, rv);

--
Gitblit v1.9.1