Skip to content

Commit 90d473d

Browse files
committed
C++: Demonstrate lack of taint through getdelim
1 parent 396ccda commit 90d473d

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,3 +591,12 @@
591591
| taint.cpp:463:6:463:6 | 0 | taint.cpp:471:7:471:7 | y | |
592592
| taint.cpp:468:7:468:7 | ref arg x | taint.cpp:470:7:470:7 | x | |
593593
| taint.cpp:468:10:468:10 | ref arg y | taint.cpp:471:7:471:7 | y | |
594+
| taint.cpp:480:26:480:32 | source1 | taint.cpp:483:28:483:34 | source1 | |
595+
| taint.cpp:481:15:481:21 | 0 | taint.cpp:483:12:483:15 | line | |
596+
| taint.cpp:481:15:481:21 | 0 | taint.cpp:485:7:485:10 | line | |
597+
| taint.cpp:482:9:482:9 | n | taint.cpp:483:19:483:19 | n | |
598+
| taint.cpp:483:11:483:15 | ref arg & ... | taint.cpp:483:12:483:15 | line [inner post update] | |
599+
| taint.cpp:483:11:483:15 | ref arg & ... | taint.cpp:485:7:485:10 | line | |
600+
| taint.cpp:483:12:483:15 | line | taint.cpp:483:11:483:15 | & ... | |
601+
| taint.cpp:483:18:483:19 | ref arg & ... | taint.cpp:483:19:483:19 | n [inner post update] | |
602+
| taint.cpp:483:19:483:19 | n | taint.cpp:483:18:483:19 | & ... | |

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,17 @@ void test_swop() {
470470
sink(x); // clean [FALSE POSITIVE]
471471
sink(y); // tainted
472472
}
473+
474+
// --- getdelim ---
475+
476+
struct FILE;
477+
478+
int getdelim(char ** lineptr, size_t * n, int delimiter, FILE *stream);
479+
480+
void test_getdelim(FILE* source1) {
481+
char* line = nullptr;
482+
size_t n;
483+
getdelim(&line, &n, '\n', source1);
484+
485+
sink(line);
486+
}

0 commit comments

Comments
 (0)