hsaturn / TinyMqtt

ESP 8266 / 32 / WROOM Small footprint Mqtt Broker and Client
GNU General Public License v3.0
191 stars 40 forks source link

Fix wrong string compare in string indexer #36

Closed dg6nee closed 1 year ago

dg6nee commented 2 years ago

fixed a wrong string compare in StringIndexer, leading to wrong behavior of the MQTT client and server. If you compare two strings with strncmp, you must also check if both have the same length, otherwise the check will get false positive results when a short string is the prefix of a longer string (e.g. "wind" <-> "window").

hsaturn commented 2 years ago

Could you please split the pull request so I can treat them individually. Yet I'm not sure to accept all the commits, but at least the string compare bug is ok for me.

hsaturn commented 1 year ago

Hello, back some months after on TinyMqtt

I'll fix the code accordingly to your commit db4b811fb6cf184855becda94b4141f337c81822.

I could not merge it because a unit test is missing. I'll write this unit test and fix this bug. Thanks for reporting

hsaturn commented 1 year ago

This PR has not been accepted as is, but I took the point and the bug is fixed. Thanks