Add files via upload

This commit is contained in:
ihsinme
2021-09-16 19:18:19 +03:00
committed by GitHub
parent b393c6a285
commit b6bcf9fa44
3 changed files with 29 additions and 0 deletions

View File

@@ -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 |

View File

@@ -0,0 +1 @@
experimental/Security/CWE/CWE-1041/FindWrapperFunctions.ql

View File

@@ -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;
}