Skip to content

Commit 0659195

Browse files
committed
C++: Rename some variables.
1 parent a2c904d commit 0659195

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

cpp/ql/src/Security/CWE/CWE-367/TOCTOUFilesystemRace.ql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,36 +92,36 @@ predicate referenceTo(Expr source, Expr use) {
9292
)
9393
}
9494

95-
from FunctionCall fc, Expr check, Expr checkUse, Expr opUse
95+
from Expr check, Expr checkPath, FunctionCall use, Expr usePath
9696
where
97-
// checkUse looks like a check on a filename
97+
// `check` looks like a check on a filename
9898
(
9999
// either:
100100
// an access check
101-
check = accessCheck(checkUse)
101+
check = accessCheck(checkPath)
102102
or
103103
// a stat
104-
check = stat(checkUse, _)
104+
check = stat(checkPath, _)
105105
or
106106
// another filename operation (null pointers can indicate errors)
107-
check = filenameOperation(checkUse)
107+
check = filenameOperation(checkPath)
108108
or
109109
// access to a member variable on the stat buf
110110
// (morally, this should be a use-use pair, but it seems unlikely
111111
// that this variable will get reused in practice)
112-
exists(Variable buf | exists(stat(checkUse, buf.getAnAccess())) |
112+
exists(Variable buf | exists(stat(checkPath, buf.getAnAccess())) |
113113
check.(VariableAccess).getQualifier() = buf.getAnAccess()
114114
)
115115
) and
116-
// checkUse and opUse refer to the same SSA variable
117-
exists(SsaDefinition def, StackVariable v | def.getAUse(v) = checkUse and def.getAUse(v) = opUse) and
118-
// opUse looks like an operation on a filename
119-
fc = filenameOperation(opUse) and
120-
// the return value of check is used (possibly with one step of
121-
// variable indirection) in a guard which controls fc
116+
// `checkPath` and `usePath` refer to the same SSA variable
117+
exists(SsaDefinition def, StackVariable v | def.getAUse(v) = checkPath and def.getAUse(v) = usePath) and
118+
// `op` looks like an operation on a filename
119+
use = filenameOperation(usePath) and
120+
// the return value of `check` is used (possibly with one step of
121+
// variable indirection) in a guard which controls `use`
122122
exists(GuardCondition guard | referenceTo(check, guard.getAChild*()) |
123-
guard.controls(fc.(ControlFlowNode).getBasicBlock(), _)
123+
guard.controls(use.(ControlFlowNode).getBasicBlock(), _)
124124
)
125-
select fc,
125+
select use,
126126
"The $@ being operated upon was previously $@, but the underlying file may have been changed since then.",
127-
opUse, "filename", check, "checked"
127+
usePath, "filename", check, "checked"

0 commit comments

Comments
 (0)