TinyMqtt icon indicating copy to clipboard operation
TinyMqtt copied to clipboard

Fix wrong string compare in string indexer

Open dg6nee opened this issue 2 years ago • 1 comments

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").

dg6nee avatar Aug 04 '22 14:08 dg6nee

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 avatar Aug 27 '22 21:08 hsaturn

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 avatar Oct 30 '22 12:10 hsaturn

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

hsaturn avatar Dec 01 '22 07:12 hsaturn