Unsafe standard function
Function unsafe for security-related purposes
Description
This defect occurs when you use standard functions that are unsafe and must not be used for security-related programming. Functions can be unsafe for many reasons. Some functions are unsafe because they are nonreentrant. Other functions change behavior depending on the target or platform, making some implementations unsafe.
Risk
Some unsafe functions are not reentrant, meaning that the contents of the function are not locked during a call. So, an attacker can change the values midstream.
getlogin
specifically can be unsafe
depending on the implementation. Some implementations of getlogin
return
only the first eight characters of a log-in name. An attacker can
use a different login with the same first eight characters to gain
entry and manipulate the program.
Fix
Avoid unsafe functions for security-related
purposes. If you cannot avoid unsafe
functions, use a safer version of the function instead. For getlogin
,
use getlogin_r
.
Examples
Result Information
Group: Security |
Language: C | C++ |
Default: Off |
Command-Line Syntax: UNSAFE_STD_FUNC |
Impact: Medium |
Version History
Introduced in R2015b
See Also
Use of obsolete standard function
| Use of dangerous standard function
| Invalid use of standard library string routine
| Find defects (-checkers)
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)