• Lance Chen's avatar
    Fix `serverURIs` iterating in MQTTAsync.c · 42f5c135
    Lance Chen authored
    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: 's avatarLance Chen <cyen0312@gmail.com>
    42f5c135