File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
cpp/ql/lib/semmle/code/cpp/commons Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11import cpp
22private import semmle.code.cpp.models.interfaces.ArrayFunction
33private import semmle.code.cpp.models.implementations.Strcat
4+ import semmle.code.cpp.dataflow.DataFlow
45
56private predicate mayAddNullTerminatorHelper ( Expr e , VariableAccess va , Expr e0 ) {
67 exists ( StackVariable v0 , Expr val |
@@ -64,10 +65,9 @@ predicate mayAddNullTerminator(Expr e, VariableAccess va) {
6465 // function containing assembler code
6566 exists ( AsmStmt s | s .getEnclosingFunction ( ) = f )
6667 or
67- // function where the relevant parameter is returned (leaking it)
68- exists ( ReturnStmt rs |
69- rs .getEnclosingFunction ( ) = f and rs .getExpr ( ) .getAChild * ( ) = f .getParameter ( i ) .getAnAccess ( )
70- )
68+ // function where the relevant parameter is returned (leaking it to be potentially null terminated elsewhere)
69+ DataFlow:: localFlow ( DataFlow:: parameterNode ( f .getParameter ( i ) ) ,
70+ DataFlow:: exprNode ( any ( ReturnStmt rs ) .getExpr ( ) ) )
7171 )
7272 or
7373 // Call without target (e.g., function pointer call)
You can’t perform that action at this time.
0 commit comments