Skip to content

Commit 0b4c4fd

Browse files
committed
C++: Simplify deallocation check
1 parent 4fb43d5 commit 0b4c4fd

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

cpp/ql/src/Critical/MissingCheckScanf.ql

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,11 @@ BasicBlock blockGuardedBy(int value, string op, ScanfFunctionCall call) {
112112
)
113113
}
114114

115-
predicate isDeallocationAccess(Access access) {
116-
exists(FunctionCall deallocCall, DeallocationFunction deallocFunc |
117-
deallocCall.getTarget() = deallocFunc
118-
|
119-
deallocCall.getArgument(deallocFunc.getFreedArg()) = access
120-
)
121-
or
122-
exists(DeallocationExpr deallocExpr | deallocExpr.getFreedExpr() = access)
123-
}
124-
125115
from ScanfOutput output, ScanfFunctionCall call, Access access
126116
where
127117
output.getCall() = call and
128118
output.hasGuardedAccess(access, false) and
129-
not isDeallocationAccess(access)
119+
not exists(DeallocationExpr dealloc | dealloc.getFreedExpr() = access)
130120
select access,
131121
"This variable is read, but may not have been written. " +
132122
"It should be guarded by a check that the $@ returns at least " +

0 commit comments

Comments
 (0)