Skip to content

Commit 24bdc34

Browse files
committed
C++: Accept test changes.
1 parent ab27d7d commit 24bdc34

3 files changed

Lines changed: 81 additions & 18 deletions

File tree

cpp/ql/test/query-tests/Security/CWE/CWE-134/SAMATE/UncontrolledFormatString.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
edges
2+
| char_connect_socket_w32_vsnprintf_01_bad.c:40:30:40:33 | *data | char_connect_socket_w32_vsnprintf_01_bad.c:47:32:47:35 | *data | provenance | |
23
| char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | char_connect_socket_w32_vsnprintf_01_bad.c:100:13:100:60 | ... = ... | provenance | |
34
| char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | provenance | |
5+
| char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | provenance | |
6+
| char_connect_socket_w32_vsnprintf_01_bad.c:100:13:100:60 | ... = ... | char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | provenance | |
47
| char_connect_socket_w32_vsnprintf_01_bad.c:100:13:100:60 | ... = ... | char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | provenance | |
8+
| char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | char_connect_socket_w32_vsnprintf_01_bad.c:40:30:40:33 | *data | provenance | |
59
| char_console_fprintf_01_bad.c:30:23:30:35 | fgets output argument | char_console_fprintf_01_bad.c:37:21:37:43 | ... = ... | provenance | |
610
| char_console_fprintf_01_bad.c:30:23:30:35 | fgets output argument | char_console_fprintf_01_bad.c:44:17:44:37 | ... = ... | provenance | |
711
| char_console_fprintf_01_bad.c:30:23:30:35 | fgets output argument | char_console_fprintf_01_bad.c:49:21:49:24 | *data | provenance | |
@@ -10,9 +14,12 @@ edges
1014
| char_environment_fprintf_01_bad.c:27:30:27:35 | *call to getenv | char_environment_fprintf_01_bad.c:27:30:27:35 | *call to getenv | provenance | |
1115
| char_environment_fprintf_01_bad.c:27:30:27:35 | *call to getenv | char_environment_fprintf_01_bad.c:36:21:36:24 | *data | provenance | TaintFunction |
1216
nodes
17+
| char_connect_socket_w32_vsnprintf_01_bad.c:40:30:40:33 | *data | semmle.label | *data |
18+
| char_connect_socket_w32_vsnprintf_01_bad.c:47:32:47:35 | *data | semmle.label | *data |
1319
| char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | semmle.label | recv output argument |
1420
| char_connect_socket_w32_vsnprintf_01_bad.c:100:13:100:60 | ... = ... | semmle.label | ... = ... |
1521
| char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | semmle.label | *data |
22+
| char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | semmle.label | *data |
1623
| char_console_fprintf_01_bad.c:30:23:30:35 | fgets output argument | semmle.label | fgets output argument |
1724
| char_console_fprintf_01_bad.c:37:21:37:43 | ... = ... | semmle.label | ... = ... |
1825
| char_console_fprintf_01_bad.c:44:17:44:37 | ... = ... | semmle.label | ... = ... |
@@ -22,6 +29,7 @@ nodes
2229
| char_environment_fprintf_01_bad.c:36:21:36:24 | *data | semmle.label | *data |
2330
subpaths
2431
#select
32+
| char_connect_socket_w32_vsnprintf_01_bad.c:47:32:47:35 | *data | char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | char_connect_socket_w32_vsnprintf_01_bad.c:47:32:47:35 | *data | The value of this argument may come from $@ and is being used as a formatting argument to vsnprintf. | char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | buffer read by recv |
2533
| char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | char_connect_socket_w32_vsnprintf_01_bad.c:125:15:125:18 | *data | The value of this argument may come from $@ and is being used as a formatting argument to badVaSink. | char_connect_socket_w32_vsnprintf_01_bad.c:94:46:94:69 | recv output argument | buffer read by recv |
2634
| char_console_fprintf_01_bad.c:49:21:49:24 | *data | char_console_fprintf_01_bad.c:30:23:30:35 | fgets output argument | char_console_fprintf_01_bad.c:49:21:49:24 | *data | The value of this argument may come from $@ and is being used as a formatting argument to fprintf. | char_console_fprintf_01_bad.c:30:23:30:35 | fgets output argument | string read by fgets |
2735
| char_environment_fprintf_01_bad.c:36:21:36:24 | *data | char_environment_fprintf_01_bad.c:27:30:27:35 | *call to getenv | char_environment_fprintf_01_bad.c:36:21:36:24 | *data | The value of this argument may come from $@ and is being used as a formatting argument to fprintf. | char_environment_fprintf_01_bad.c:27:30:27:35 | *call to getenv | an environment variable |

cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/funcs/funcsLocal.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ void test() {
107107
va_list args = 0;
108108
_locale_t locale = 0;
109109
fread(fmt, sizeof(char), 1024, f);
110-
vprintf(fmt, args); // MISSING: BAD
111-
_vprintf_l(fmt, locale, args); // MISSING: BAD
112-
vfprintf(f, fmt, args); // MISSING: BAD
113-
_vfprintf_l(f, fmt, locale, args); // MISSING: BAD
114-
vsnprintf(out, 1024, fmt, args); // MISSING: BAD
115-
_vsnprintf(out, 1024, fmt, args); // MISSING: BAD
116-
_vsnprintf_l(out, 1024, fmt, locale, args); // MISSING: BAD
117-
vsnprintf_s(out, 1024, 1024, fmt, args); // MISSING: BAD
118-
_vsnprintf_s(out, 1024, 1024, fmt, args); // MISSING: BAD
119-
_vsnprintf_s_l(out, 1024, 1024, fmt, locale, args); // MISSING: BAD
120-
vsprintf(out, fmt, args); // MISSING: BAD
121-
_vsprintf_l(out, fmt, locale, args); // MISSING: BAD
122-
_vsprintf_p(out, 1024, fmt, args); // MISSING: BAD
123-
_vsprintf_p_l(out, 1024, fmt, locale, args); // MISSING: BAD
124-
vsprintf_s(out, 1024, fmt, args); // MISSING: BAD
125-
_vsprintf_s_l(out, 1024, fmt, locale, args); // MISSING: BAD
126-
_vscprintf_p(fmt, args); // MISSING: BAD
127-
_vscprintf_p_l(fmt, locale, args); // MISSING: BAD
110+
vprintf(fmt, args); // BAD
111+
_vprintf_l(fmt, locale, args); // BAD
112+
vfprintf(f, fmt, args); // BAD
113+
_vfprintf_l(f, fmt, locale, args); // BAD
114+
vsnprintf(out, 1024, fmt, args); // BAD
115+
_vsnprintf(out, 1024, fmt, args); // BAD
116+
_vsnprintf_l(out, 1024, fmt, locale, args); // BAD
117+
vsnprintf_s(out, 1024, 1024, fmt, args); // BAD
118+
_vsnprintf_s(out, 1024, 1024, fmt, args); // BAD
119+
_vsnprintf_s_l(out, 1024, 1024, fmt, locale, args); // BAD
120+
vsprintf(out, fmt, args); // BAD
121+
_vsprintf_l(out, fmt, locale, args); // BAD
122+
_vsprintf_p(out, 1024, fmt, args); // BAD
123+
_vsprintf_p_l(out, 1024, fmt, locale, args); // BAD
124+
vsprintf_s(out, 1024, fmt, args); // BAD
125+
_vsprintf_s_l(out, 1024, fmt, locale, args); // BAD
126+
_vscprintf_p(fmt, args); // BAD
127+
_vscprintf_p_l(fmt, locale, args); // BAD
128128
}

cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/funcs/funcsLocal.expected

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ edges
1111
| funcsLocal.c:52:2:52:16 | *... = ... | funcsLocal.c:53:9:53:11 | ** ... | provenance | |
1212
| funcsLocal.c:52:8:52:11 | *call to gets | funcsLocal.c:52:2:52:16 | *... = ... | provenance | |
1313
| funcsLocal.c:57:2:57:14 | ... = ... | funcsLocal.c:58:9:58:10 | *e1 | provenance | |
14+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:110:10:110:12 | *fmt | provenance | |
15+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:111:13:111:15 | *fmt | provenance | |
16+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:112:14:112:16 | *fmt | provenance | |
17+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:113:17:113:19 | *fmt | provenance | |
18+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:114:23:114:25 | *fmt | provenance | |
19+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:115:24:115:26 | *fmt | provenance | |
20+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:116:26:116:28 | *fmt | provenance | |
21+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:117:31:117:33 | *fmt | provenance | |
22+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:118:32:118:34 | *fmt | provenance | |
23+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:119:34:119:36 | *fmt | provenance | |
24+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:120:16:120:18 | *fmt | provenance | |
25+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:121:19:121:21 | *fmt | provenance | |
26+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:122:25:122:27 | *fmt | provenance | |
27+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:123:27:123:29 | *fmt | provenance | |
28+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:124:24:124:26 | *fmt | provenance | |
29+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:125:27:125:29 | *fmt | provenance | |
30+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:126:15:126:17 | *fmt | provenance | |
31+
| funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:127:17:127:19 | *fmt | provenance | |
1432
nodes
1533
| funcsLocal.c:16:8:16:9 | fread output argument | semmle.label | fread output argument |
1634
| funcsLocal.c:17:9:17:10 | *i1 | semmle.label | *i1 |
@@ -31,6 +49,25 @@ nodes
3149
| funcsLocal.c:53:9:53:11 | ** ... | semmle.label | ** ... |
3250
| funcsLocal.c:57:2:57:14 | ... = ... | semmle.label | ... = ... |
3351
| funcsLocal.c:58:9:58:10 | *e1 | semmle.label | *e1 |
52+
| funcsLocal.c:109:8:109:10 | fread output argument | semmle.label | fread output argument |
53+
| funcsLocal.c:110:10:110:12 | *fmt | semmle.label | *fmt |
54+
| funcsLocal.c:111:13:111:15 | *fmt | semmle.label | *fmt |
55+
| funcsLocal.c:112:14:112:16 | *fmt | semmle.label | *fmt |
56+
| funcsLocal.c:113:17:113:19 | *fmt | semmle.label | *fmt |
57+
| funcsLocal.c:114:23:114:25 | *fmt | semmle.label | *fmt |
58+
| funcsLocal.c:115:24:115:26 | *fmt | semmle.label | *fmt |
59+
| funcsLocal.c:116:26:116:28 | *fmt | semmle.label | *fmt |
60+
| funcsLocal.c:117:31:117:33 | *fmt | semmle.label | *fmt |
61+
| funcsLocal.c:118:32:118:34 | *fmt | semmle.label | *fmt |
62+
| funcsLocal.c:119:34:119:36 | *fmt | semmle.label | *fmt |
63+
| funcsLocal.c:120:16:120:18 | *fmt | semmle.label | *fmt |
64+
| funcsLocal.c:121:19:121:21 | *fmt | semmle.label | *fmt |
65+
| funcsLocal.c:122:25:122:27 | *fmt | semmle.label | *fmt |
66+
| funcsLocal.c:123:27:123:29 | *fmt | semmle.label | *fmt |
67+
| funcsLocal.c:124:24:124:26 | *fmt | semmle.label | *fmt |
68+
| funcsLocal.c:125:27:125:29 | *fmt | semmle.label | *fmt |
69+
| funcsLocal.c:126:15:126:17 | *fmt | semmle.label | *fmt |
70+
| funcsLocal.c:127:17:127:19 | *fmt | semmle.label | *fmt |
3471
subpaths
3572
#select
3673
| funcsLocal.c:17:9:17:10 | *i1 | funcsLocal.c:16:8:16:9 | fread output argument | funcsLocal.c:17:9:17:10 | *i1 | The value of this argument may come from $@ and is being used as a formatting argument to printf. | funcsLocal.c:16:8:16:9 | fread output argument | string read by fread |
@@ -41,3 +78,21 @@ subpaths
4178
| funcsLocal.c:47:9:47:11 | ** ... | funcsLocal.c:46:7:46:9 | gets output argument | funcsLocal.c:47:9:47:11 | ** ... | The value of this argument may come from $@ and is being used as a formatting argument to printf. | funcsLocal.c:46:7:46:9 | gets output argument | string read by gets |
4279
| funcsLocal.c:53:9:53:11 | ** ... | funcsLocal.c:52:8:52:11 | *call to gets | funcsLocal.c:53:9:53:11 | ** ... | The value of this argument may come from $@ and is being used as a formatting argument to printf. | funcsLocal.c:52:8:52:11 | *call to gets | string read by gets |
4380
| funcsLocal.c:58:9:58:10 | *e1 | funcsLocal.c:16:8:16:9 | fread output argument | funcsLocal.c:58:9:58:10 | *e1 | The value of this argument may come from $@ and is being used as a formatting argument to printf. | funcsLocal.c:16:8:16:9 | fread output argument | string read by fread |
81+
| funcsLocal.c:110:10:110:12 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:110:10:110:12 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to vprintf. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
82+
| funcsLocal.c:111:13:111:15 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:111:13:111:15 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vprintf_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
83+
| funcsLocal.c:112:14:112:16 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:112:14:112:16 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to vfprintf. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
84+
| funcsLocal.c:113:17:113:19 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:113:17:113:19 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vfprintf_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
85+
| funcsLocal.c:114:23:114:25 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:114:23:114:25 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to vsnprintf. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
86+
| funcsLocal.c:115:24:115:26 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:115:24:115:26 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsnprintf. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
87+
| funcsLocal.c:116:26:116:28 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:116:26:116:28 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsnprintf_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
88+
| funcsLocal.c:117:31:117:33 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:117:31:117:33 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to vsnprintf_s. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
89+
| funcsLocal.c:118:32:118:34 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:118:32:118:34 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsnprintf_s. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
90+
| funcsLocal.c:119:34:119:36 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:119:34:119:36 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsnprintf_s_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
91+
| funcsLocal.c:120:16:120:18 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:120:16:120:18 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to vsprintf. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
92+
| funcsLocal.c:121:19:121:21 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:121:19:121:21 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsprintf_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
93+
| funcsLocal.c:122:25:122:27 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:122:25:122:27 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsprintf_p. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
94+
| funcsLocal.c:123:27:123:29 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:123:27:123:29 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsprintf_p_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
95+
| funcsLocal.c:124:24:124:26 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:124:24:124:26 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to vsprintf_s. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
96+
| funcsLocal.c:125:27:125:29 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:125:27:125:29 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vsprintf_s_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
97+
| funcsLocal.c:126:15:126:17 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:126:15:126:17 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vscprintf_p. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |
98+
| funcsLocal.c:127:17:127:19 | *fmt | funcsLocal.c:109:8:109:10 | fread output argument | funcsLocal.c:127:17:127:19 | *fmt | The value of this argument may come from $@ and is being used as a formatting argument to _vscprintf_p_l. | funcsLocal.c:109:8:109:10 | fread output argument | string read by fread |

0 commit comments

Comments
 (0)