...
| Code Block | ||
|---|---|---|
| ||
FILE *fd = fopen(filename, "r");
if (fd) {
/*...*/
/* file opened */
}
fclose(fd);
|
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
| Wiki Markup |
|---|
\[[SeacordDrepper 0506|AA. C References#SeacordReferences#Drepper 0506]\] Chapter 7, "File I/OSection 2.2.1 "Identification When Opening" \[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section 7.19.3, "Files," and Section 7.19.4, "Operations on Files" \[[MITRE 07|AA. C References#MITRE 07]\] [CWE ID 37|http://cwe.mitre.org/data/definitions/37.html], "Path Issue - Slash Absolute Path"; [CWE ID 38|http://cwe.mitre.org/data/definitions/38.html], "Path Issue - Backslash Absolute Path"; [CWE ID 39|http://cwe.mitre.org/data/definitions/39.html], "Path Issue - Drive Letter or Windows Volume"; [CWE ID 62|http://cwe.mitre.org/data/definitions/62.html], "UNIX Hard Link"; [CWE ID 64|http://cwe.mitre.org/data/definitions/64.html], "Windows Shortcut Following (.LNK)"; [CWE ID 65|http://cwe.mitre.org/data/definitions/65.html], "Windows Hard Link" \[[Open Group 04|AA. C References#Open Group 04]\] "The open function," "The fstat function" \[[DrepperSeacord 0605|AA. C References#DrepperReferences#Seacord 0605]\] Section 2.2.1Chapter 7, "Identification When OpeningFile I/O" |