luxonis / XLink

A cross-platform library for communicating with devices over various physical links.
Apache License 2.0
11 stars 17 forks source link

duplicate decrement in `XLinkPlatformFindDevices()` #56

Closed diablodale closed 1 month ago

diablodale commented 1 year ago

XLinkPlatformFindDevices() errantly double-decrements when looking for TCPIP devices line 118 is wrong and should be removed

https://github.com/luxonis/XLink/blob/d209b7eeb8ac68435df5097e57e1dfd8ea1d0e83/src/pc/PlatformDeviceSearch.c#L115-L124

Setup

Repro

Found during code review. Referencing above, line 118 should be removed. Line 123 does the correct decrement.

I also caution that lines 89 and 120 are missing a dangerous scenario. If numFoundDevices > sizeFoundDevices that means that memory was overwritten/corrupted. That scenario must never occur.