File tree Expand file tree Collapse file tree 4 files changed +37
-0
lines changed
cpp/ql/test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree 4 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 152152| stl.cpp:105:2:105:4 | ss1 [post update] | stl.cpp:110:7:110:9 | ss1 | |
153153| stl.cpp:106:2:106:4 | ss2 [post update] | stl.cpp:109:7:109:9 | ss2 | |
154154| stl.cpp:106:2:106:4 | ss2 [post update] | stl.cpp:111:7:111:9 | ss2 | |
155+ | stl.cpp:124:16:124:28 | call to basic_string | stl.cpp:125:7:125:11 | path1 | |
156+ | stl.cpp:124:17:124:26 | call to user_input | stl.cpp:124:16:124:28 | call to basic_string | TAINT |
157+ | stl.cpp:125:7:125:11 | path1 | stl.cpp:125:13:125:17 | call to c_str | TAINT |
158+ | stl.cpp:128:10:128:19 | call to user_input | stl.cpp:128:10:128:21 | call to basic_string | TAINT |
159+ | stl.cpp:128:10:128:21 | call to basic_string | stl.cpp:128:2:128:21 | ... = ... | |
160+ | stl.cpp:128:10:128:21 | call to basic_string | stl.cpp:129:7:129:11 | path2 | |
161+ | stl.cpp:129:7:129:11 | path2 | stl.cpp:129:13:129:17 | call to c_str | TAINT |
162+ | stl.cpp:131:15:131:24 | call to user_input | stl.cpp:131:15:131:27 | call to basic_string | TAINT |
163+ | stl.cpp:131:15:131:27 | call to basic_string | stl.cpp:132:7:132:11 | path3 | |
164+ | stl.cpp:132:7:132:11 | path3 | stl.cpp:132:13:132:17 | call to c_str | TAINT |
155165| taint.cpp:4:27:4:33 | source1 | taint.cpp:6:13:6:19 | source1 | |
156166| taint.cpp:4:40:4:45 | clean1 | taint.cpp:5:8:5:13 | clean1 | |
157167| taint.cpp:4:40:4:45 | clean1 | taint.cpp:6:3:6:8 | clean1 | |
Original file line number Diff line number Diff line change @@ -110,3 +110,24 @@ void test_stringstream_int(int source)
110110 sink (ss1.str ());
111111 sink (ss2.str ()); // tainted [NOT DETECTED]
112112}
113+
114+ using namespace std ;
115+
116+ char *user_input () {
117+ return source ();
118+ }
119+
120+ void sink (const char *filename, const char *mode);
121+
122+ void test_strings2 ()
123+ {
124+ string path1 = user_input ();
125+ sink (path1.c_str (), " r" ); // tainted
126+
127+ string path2;
128+ path2 = user_input ();
129+ sink (path2.c_str (), " r" ); // tainted
130+
131+ string path3 (user_input ());
132+ sink (path3.c_str (), " r" ); // tainted
133+ }
Original file line number Diff line number Diff line change 1111| stl.cpp:71:7:71:7 | a | stl.cpp:67:12:67:17 | call to source |
1212| stl.cpp:73:7:73:7 | c | stl.cpp:69:16:69:21 | call to source |
1313| stl.cpp:75:9:75:13 | call to c_str | stl.cpp:69:16:69:21 | call to source |
14+ | stl.cpp:125:13:125:17 | call to c_str | stl.cpp:117:10:117:15 | call to source |
15+ | stl.cpp:129:13:129:17 | call to c_str | stl.cpp:117:10:117:15 | call to source |
16+ | stl.cpp:132:13:132:17 | call to c_str | stl.cpp:117:10:117:15 | call to source |
1417| taint.cpp:8:8:8:13 | clean1 | taint.cpp:4:27:4:33 | source1 |
1518| taint.cpp:16:8:16:14 | source1 | taint.cpp:12:22:12:27 | call to source |
1619| taint.cpp:17:8:17:16 | ++ ... | taint.cpp:12:22:12:27 | call to source |
Original file line number Diff line number Diff line change 1010| format.cpp:106:8:106:14 | format.cpp:105:38:105:52 | AST only |
1111| stl.cpp:73:7:73:7 | stl.cpp:69:16:69:21 | AST only |
1212| stl.cpp:75:9:75:13 | stl.cpp:69:16:69:21 | AST only |
13+ | stl.cpp:125:13:125:17 | stl.cpp:117:10:117:15 | AST only |
14+ | stl.cpp:129:13:129:17 | stl.cpp:117:10:117:15 | AST only |
15+ | stl.cpp:132:13:132:17 | stl.cpp:117:10:117:15 | AST only |
1316| taint.cpp:41:7:41:13 | taint.cpp:35:12:35:17 | AST only |
1417| taint.cpp:42:7:42:13 | taint.cpp:35:12:35:17 | AST only |
1518| taint.cpp:43:7:43:13 | taint.cpp:37:22:37:27 | AST only |
You can’t perform that action at this time.
0 commit comments