Closed fschaeck closed 1 year ago
Thanks a lot for reporting and fixing this bug :). Please use opening and closing curly brackets in if clauses etc. as we do in the rest of the code. Once formatting is in order, I'll merge this into master.
Thanks a lot!
Okay! I fixed the formatting for the whole file since I was at it.
An exception was thrown after publishing a json message in mqtt_mode 3. Apparently a buffer overlow in outBuf was responsible for the exception, since it did not happen for mqtt_mode 1 or 2, where the messages are significantly shorter. The refactored function mqtt_sendtoBroker() is not using outBuf anymore.
Also in the buffer overflow protection of function mqttcallback(...) 4 bytes were reserved for creating the acknowledgement message from the original message, but 5 bytes are needed (4 for the ACK prefix and one for the terminating nul character).
This pull request is fixing issue #520