Skip to content

Commit 3f3988c

Browse files
authored
Add files via upload
1 parent 8e8a324 commit 3f3988c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test.cpp:11:20:11:25 | call to tmpnam | Finding the name of a file that does not exist does not mean that it will not be exist at the next operation. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
typedef int FILE;
2+
#define NULL (0)
3+
FILE *fopen(char *filename, const char *mode);
4+
char * tmpnam(char * name);
5+
int fprintf(FILE *fp,const char *fmt, ...);
6+
int fclose(FILE *stream);
7+
8+
int main(int argc, char *argv[])
9+
{
10+
FILE *fp;
11+
char *filename = tmpnam(NULL); // BAD
12+
fp = fopen(filename,"w");
13+
fprintf(fp,"%s\n","data to file");
14+
fclose(fp);
15+
return 0;
16+
}

0 commit comments

Comments
 (0)