381 – Use of absolute paths
Summary
The system files must be referenced through absolute paths.
Description
An absolute path provides the complete and unambiguous location of a file or directory from the root of the file system. These paths eliminate ambiguity that may arise with relative paths, especially in situations where the current working directory may vary. In other words, this practice of using absolute paths enhances clarity, predictability, and consistency in file referencing within a code.
Supported In
Advanced: True
References
- CWE-73. External control of file name or path
- CWE-710. Improper adherence to coding standards
- SANS25-8. Improper limitation of a pathname to a restricted directory (path traversal)
- SANS25-12. NULL pointer dereference
- CWE25-22. Improper limitation of a pathname to a restricted directory (path traversal)
- CWE25-476. NULL pointer dereference
Last updated
2024/02/05