Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8faf95e

Browse files
committed
[CPP-370] Tentatively modify CWE consts.cpp file to play nice with the dataflow library.
1 parent 1fce5a5 commit 8faf95e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
| consts.cpp:81:9:81:10 | c8 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
2+
| consts.cpp:86:9:86:10 | v1 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
23
| consts.cpp:91:9:91:10 | v2 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
4+
| consts.cpp:95:9:95:10 | v3 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
5+
| consts.cpp:100:9:100:10 | v4 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
36
| consts.cpp:103:9:103:15 | call to varFunc | The format string argument to printf should be constant to prevent security issues and other potential errors. |
47
| consts.cpp:107:9:107:10 | v5 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
58
| consts.cpp:112:9:112:10 | v6 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
69
| consts.cpp:116:9:116:13 | access to array | The format string argument to printf should be constant to prevent security issues and other potential errors. |
710
| consts.cpp:121:9:121:10 | v8 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
11+
| consts.cpp:130:9:130:10 | v9 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
812
| consts.cpp:135:9:135:11 | v10 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
913
| consts.cpp:140:9:140:11 | v11 | The format string argument to printf should be constant to prevent security issues and other potential errors. |
1014
| consts.cpp:145:9:145:11 | v12 | The format string argument to printf should be constant to prevent security issues and other potential errors. |

cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/consts/consts.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ void a() {
5959

6060
// GOOD: constFunc() always returns a constant string
6161
// But we still don't track constantness flow from functions to variables
62-
char *c5 = constFunc();
62+
char *c5 = constFunc();
6363
printf(c5);
6464

6565
// GOOD: constFunc() always returns a constant string
6666
// But we still don't track constantness flow from functions to variables
67-
char *c6;
67+
char *c6;
6868
c6 = constFunc();
6969
printf(c6);
7070

@@ -81,7 +81,7 @@ void a() {
8181
printf(c8);
8282

8383
// BAD: v1 value came from the user
84-
char *v1;
84+
char v1[100];
8585
gets(v1);
8686
printf(v1);
8787

@@ -125,7 +125,7 @@ void a() {
125125
// BAD: nonConstFuncToArray() always returns a value from gv1, which is started as constant but was changed to a value that came from the user
126126
printf(nonConstFuncToArray(0));
127127

128-
// BAD: v9 value is copied from v1, which came from the user [NOT DETECTED]
128+
// BAD: v9 value is copied from v1, which came from the user
129129
const char *v9 = v1;
130130
printf(v9);
131131

0 commit comments

Comments
 (0)