Skip to content

Commit 4a355fc

Browse files
authored
Merge pull request #129 from knewbury01/knewbury01/format-fix-sharedquery
Fix formatting shared query ConstLikeReturnValue
2 parents d0ca048 + d323bb1 commit 4a355fc

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
problems
2-
| test.c:8:8:8:12 | c_str | The object returned by the function getenv should not be modified. | test.c:15:16:15:21 | call to getenv | call to getenv | test.c:8:8:8:12 | c_str | c_str |
3-
| test.c:64:5:64:9 | conv4 | The object returned by the function localeconv should not be modified. | test.c:61:11:61:20 | call to localeconv | call to localeconv | test.c:64:5:64:9 | conv4 | conv4 |
4-
| test.c:73:5:73:8 | conv | The object returned by the function localeconv should not be modified. | test.c:69:25:69:34 | call to localeconv | call to localeconv | test.c:73:5:73:8 | conv | conv |
2+
| test.c:8:8:8:12 | c_str | test.c:15:16:15:21 | call to getenv | test.c:8:8:8:12 | c_str | The object returned by the function getenv should not be modified. |
3+
| test.c:64:5:64:9 | conv4 | test.c:61:11:61:20 | call to localeconv | test.c:64:5:64:9 | conv4 | The object returned by the function localeconv should not be modified. |
4+
| test.c:73:5:73:8 | conv | test.c:69:25:69:34 | call to localeconv | test.c:73:5:73:8 | conv | The object returned by the function localeconv should not be modified. |
55
edges
66
| test.c:5:18:5:22 | c_str | test.c:8:8:8:12 | c_str |
77
| test.c:15:16:15:21 | call to getenv | test.c:21:9:21:12 | env1 |

cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,13 @@ class DFConf extends DataFlow::Configuration {
5252
}
5353

5454
query predicate problems(
55-
Element e, string message, DataFlow::PathNode source, string sourcetext, DataFlow::PathNode sink,
56-
string sinktext
55+
Element e, DataFlow::PathNode source, DataFlow::PathNode sink, string message
5756
) {
5857
not isExcluded(e, getQuery()) and
5958
// the modified object comes from a call to one of the ENV functions
6059
any(DFConf d).hasFlowPath(source, sink) and
6160
e = sink.getNode().asExpr() and
6261
message =
6362
"The object returned by the function " +
64-
source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should not be modified." and
65-
sourcetext = source.toString() and
66-
sinktext = sink.toString()
63+
source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should not be modified."
6764
}

0 commit comments

Comments
 (0)