Skip to content

Commit 562c8b9

Browse files
Robert MarshRobert Marsh
authored andcommitted
C++: add comment explaining concatenation logic
1 parent 6f408f9 commit 562c8b9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Expr sinkAsArgumentIndirection(DataFlow::Node sink) {
3131
.getUnconvertedResultExpression()
3232
}
3333

34+
/**
35+
* Holds if `fst` is a string that is used in a format or concatenation function resulting in `snd`,
36+
* and is *not* placed at the start of the resulting string. This indicates that the author did not
37+
* expect `fst` to control what program is run if the resulting string is eventually interpreted as
38+
* a command line, for example as an argument to `system`.
39+
*/
3440
predicate interestingConcatenation(DataFlow::Node fst, DataFlow::Node snd) {
3541
exists(FormattingFunctionCall call, int index, FormatLiteral literal |
3642
sinkAsArgumentIndirection(fst) = call.getConversionArgument(index) and

0 commit comments

Comments
 (0)