From d323bb1d38fef3f50f10e24a2dcecfacbcf33bff Mon Sep 17 00:00:00 2001 From: Kristen Newbury Date: Tue, 8 Nov 2022 10:10:49 -0500 Subject: [PATCH] Fix formatting shared query ConstLikeReturnValue --- .../constlikereturnvalue/ConstLikeReturnValue.expected | 6 +++--- .../rules/constlikereturnvalue/ConstLikeReturnValue.qll | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.expected b/c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.expected index 76be777469..94e63062c5 100644 --- a/c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.expected +++ b/c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.expected @@ -1,7 +1,7 @@ problems -| 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 | -| 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 | -| 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 | +| 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. | +| 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. | +| 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. | edges | test.c:5:18:5:22 | c_str | test.c:8:8:8:12 | c_str | | test.c:15:16:15:21 | call to getenv | test.c:21:9:21:12 | env1 | diff --git a/cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll b/cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll index dde44214b8..5499e4ae42 100644 --- a/cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll +++ b/cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll @@ -52,8 +52,7 @@ class DFConf extends DataFlow::Configuration { } query predicate problems( - Element e, string message, DataFlow::PathNode source, string sourcetext, DataFlow::PathNode sink, - string sinktext + Element e, DataFlow::PathNode source, DataFlow::PathNode sink, string message ) { not isExcluded(e, getQuery()) and // the modified object comes from a call to one of the ENV functions @@ -61,7 +60,5 @@ query predicate problems( e = sink.getNode().asExpr() and message = "The object returned by the function " + - source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should not be modified." and - sourcetext = source.toString() and - sinktext = sink.toString() + source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should not be modified." }