Fix `serverURIs` iterating in MQTTAsync.c
This commit fixes two bugs related to `serverURIs` iterating in MQTTAsync.c
1. Segfault occurs when there is no healthy connection in `serverURIs`
Two off-by-one errors of the `currentURI` cause the issue. The first
one happens when doing boundary check of `serverURIs`, and the other
one happens when accessing `serverURIs` without checking the boundary
first.
2. The first URI in `serverURIs` gets skipped when restricting
`MQTTVersion` to a particular value
`currentURI` gets increased *before* connection attempts in each
iteration.
Signed-off-by:
Lance Chen <cyen0312@gmail.com>
Showing
Please
register
or
sign in
to comment