Skip to content

Commit c6d8abc

Browse files
committed
C++: Add a couple more testcases.
1 parent 5d1c784 commit c6d8abc

File tree

1 file changed

+25
-0
lines changed
  • cpp/ql/test/query-tests/Security/CWE/CWE-367/semmle

1 file changed

+25
-0
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-367/semmle/test2.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,28 @@ void test6_5(const char *path1, const char *path2)
331331
// ...
332332
}
333333
}
334+
335+
// --- open / rename -> chmod ---
336+
337+
void test7_1(const char *path)
338+
{
339+
FILE *f;
340+
341+
f = fopen(path, "wt");
342+
if (f != 0)
343+
{
344+
// ...
345+
346+
fclose(f);
347+
348+
chmod(path, 1234); // BAD [NOT DETECTED]
349+
}
350+
}
351+
352+
void test7_1(const char *path1, const char *path2)
353+
{
354+
if (!rename(path1, path2))
355+
{
356+
chmod(path2, 1234); // BAD [NOT DETECTED]
357+
}
358+
}

0 commit comments

Comments
 (0)