mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Add files via upload
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| test.cpp:23:3:23:8 | call to fclose | consider changing the call to $@ | test.cpp:9:6:9:13 | myFclose | myFclose |
|
||||
@@ -0,0 +1 @@
|
||||
experimental/Security/CWE/CWE-1041/FindWrapperFunctions.ql
|
||||
@@ -0,0 +1,27 @@
|
||||
#define NULL (0)
|
||||
typedef int FILE;
|
||||
FILE *fopen(const char *filename, const char *mode);
|
||||
int fclose(FILE *stream);
|
||||
extern FILE * fe;
|
||||
extern int printf(const char *fmt, ...);
|
||||
void exit(int status);
|
||||
|
||||
void myFclose(FILE * fmy)
|
||||
{
|
||||
int i;
|
||||
if(fmy) {
|
||||
i = fclose(fmy);
|
||||
fmy = NULL;
|
||||
printf("close end is code %d",i);
|
||||
if(i!=0) exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
fe = fopen("myFile.txt", "wt");
|
||||
fclose(fe); // BAD
|
||||
fe = fopen("myFile.txt", "wt");
|
||||
myFclose(fe); // GOOD
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user