...
Note that this solution treats any trailing characters, including whitespace characters, as an error condition.
Risk Assessment
While it Although it is relatively rare for a violation of this recommendation to result in a security vulnerability, it can easily result in lost or misinterpreted data.
...
CERT C++ Secure Coding Standard: INT05-CPP. Do not use input functions to convert character data if they cannot handle all possible inputs
ISO/IEC 9899:2011 Section Section 7.22.1.4, "The strtol
, strtoll
, strtoul
, and strtoull
functions," and Section 7.21.6, "Formatted input/output functions"
...