Skip to content

Commit d6a714c

Browse files
committed
C++: Improve comments.
1 parent 3a1836c commit d6a714c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cpp/ql/lib/semmle/code/cpp/commons/NullTermination.qll

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ private import semmle.code.cpp.models.interfaces.ArrayFunction
33
private import semmle.code.cpp.models.implementations.Strcat
44
import semmle.code.cpp.dataflow.DataFlow
55

6+
/**
7+
* Holds if the expression `e` assigns something including `va` to a
8+
* stack variable that is later null terminated at `e0`.
9+
*/
610
private predicate mayAddNullTerminatorHelper(Expr e, VariableAccess va, Expr e0) {
711
exists(StackVariable v0, Expr val |
8-
exprDefinition(v0, e, val) and
12+
exprDefinition(v0, e, val) and // `e` is `v0 := val`
913
val.getAChild*() = va and
1014
mayAddNullTerminator(e0, v0.getAnAccess())
1115
)
@@ -25,8 +29,8 @@ private predicate controlFlowNodeSuccessorTransitive(ControlFlowNode n1, Control
2529
}
2630

2731
/**
28-
* Holds if the expression `e` may add a null terminator to the string in
29-
* variable `v`.
32+
* Holds if the expression `e` may add a null terminator to the string
33+
* accessed by `va`.
3034
*/
3135
predicate mayAddNullTerminator(Expr e, VariableAccess va) {
3236
// Assignment: dereferencing or array access

0 commit comments

Comments
 (0)