fix Buffer overflow if Com Port index is wrong in device config file