Skip to content

Commit 625c47f

Browse files
committed
C++: Add a testcase.
1 parent 4291c75 commit 625c47f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6657,6 +6657,23 @@ WARNING: Module TaintTracking has been deprecated and may be removed in future (
66576657
| taint.cpp:745:27:745:32 | buffer | taint.cpp:745:19:745:25 | call to realloc | TAINT |
66586658
| taint.cpp:746:9:746:15 | * ... | taint.cpp:746:8:746:15 | * ... | TAINT |
66596659
| taint.cpp:746:10:746:15 | buffer | taint.cpp:746:9:746:15 | * ... | TAINT |
6660+
| taint.cpp:751:31:751:34 | path | taint.cpp:751:31:751:34 | path | |
6661+
| taint.cpp:751:31:751:34 | path | taint.cpp:752:10:752:13 | path | |
6662+
| taint.cpp:751:31:751:34 | path | taint.cpp:753:10:753:13 | path | |
6663+
| taint.cpp:751:43:751:46 | data | taint.cpp:751:43:751:46 | data | |
6664+
| taint.cpp:751:43:751:46 | data | taint.cpp:753:22:753:25 | data | |
6665+
| taint.cpp:752:10:752:13 | ref arg path | taint.cpp:751:31:751:34 | path | |
6666+
| taint.cpp:752:10:752:13 | ref arg path | taint.cpp:753:10:753:13 | path | |
6667+
| taint.cpp:752:16:752:19 | %s | taint.cpp:752:10:752:13 | ref arg path | TAINT |
6668+
| taint.cpp:752:22:752:26 | abc | taint.cpp:752:10:752:13 | ref arg path | TAINT |
6669+
| taint.cpp:753:10:753:13 | ref arg path | taint.cpp:751:31:751:34 | path | |
6670+
| taint.cpp:753:16:753:19 | %s | taint.cpp:753:10:753:13 | ref arg path | TAINT |
6671+
| taint.cpp:753:22:753:25 | data | taint.cpp:753:10:753:13 | ref arg path | TAINT |
6672+
| taint.cpp:753:22:753:25 | ref arg data | taint.cpp:751:43:751:46 | data | |
6673+
| taint.cpp:757:7:757:10 | path | taint.cpp:758:21:758:24 | path | |
6674+
| taint.cpp:757:7:757:10 | path | taint.cpp:759:8:759:11 | path | |
6675+
| taint.cpp:758:21:758:24 | ref arg path | taint.cpp:759:8:759:11 | path | |
6676+
| taint.cpp:759:8:759:11 | path | taint.cpp:759:7:759:11 | * ... | |
66606677
| vector.cpp:16:43:16:49 | source1 | vector.cpp:17:26:17:32 | source1 | |
66616678
| vector.cpp:16:43:16:49 | source1 | vector.cpp:31:38:31:44 | source1 | |
66626679
| vector.cpp:17:21:17:33 | call to vector | vector.cpp:19:14:19:14 | v | |

cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,4 +744,17 @@ void test_realloc_2_indirections(int **buffer) {
744744
**buffer = source();
745745
buffer = (int**)realloc(buffer, 16);
746746
sink(**buffer); // $ ir MISSING: ast
747+
}
748+
749+
int sprintf(char *, const char *, ...);
750+
751+
void call_sprintf_twice(char* path, char* data) {
752+
sprintf(path, "%s", "abc");
753+
sprintf(path, "%s", data);
754+
}
755+
756+
void test_call_sprintf() {
757+
char path[10];
758+
call_sprintf_twice(path, indirect_source());
759+
sink(*path); // $ ir ast
747760
}

0 commit comments

Comments
 (0)