powerapi-ng / hwpc-sensor

Hardware Performance Counters monitoring agent for containers.
BSD 3-Clause "New" or "Revised" License
14 stars 16 forks source link

fix: check on wrong return value in addr_init #13

Closed PierreRustOrange closed 2 years ago

PierreRustOrange commented 2 years ago

addr_init calls inet_pton, which returns 0 when the supplied does string does not represent a valid network address in the specified address family. We were checking for -1 instead of 0, missing this error case. Due to that error, the sensor accepts any value in the socket output configuration, even invalid ip address, and blocks instead of reporting an error. git reset --soft HEAD~1