Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace atoi with strtol (sonic-net#6)
From Semgrep: https://semgrep.dev/r?q=c.lang.correctness.incorrect-use-ato-fn.incorrect-use-ato-fn > Avoid the 'ato*()' family of functions. Their use can lead to undefined behavior, integer overflows, and lack of appropriate error handling. Instead prefer the 'strtol*()' family of functions. From atoi() man page: https://www.man7.org/linux/man-pages/man3/atoi.3.html > The atoi() function converts the initial portion of the string pointed to by nptr to int. The behavior is the same as > strtol(nptr, NULL, 10); > except that atoi() does not detect errors. Therefore, replace atoi() with strtol() Verified by kill dhcpmon process, installing new .deb change to dhcp_relay docker, execute dhcpmon process, check if counters is printing in syslog, compare counters before and after this change. logs: [before.txt](https://github.com/sonic-net/sonic-dhcpmon/files/11377335/before.txt) [after.txt](https://github.com/sonic-net/sonic-dhcpmon/files/11377336/after.txt) example commands: [command.txt](https://github.com/sonic-net/sonic-dhcpmon/files/11423945/command.txt)
- Loading branch information