Skip to content

Commit 464f6cb

Browse files
committed
C++/ConstantSizeArrayOffByOne
1 parent 974d174 commit 464f6cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,14 @@ module ArrayAddressToDerefConfig implements DataFlow::StateConfigSig {
187187
predicate observeDiffInformedIncrementalMode() { any() }
188188

189189
Location getASelectedSourceLocation(DataFlow::Node source) {
190-
exists(Variable v | result = v.getLocation() | isSourceImpl(source, v))
190+
exists(Variable v | result = v.getLocation() or result = source.getLocation() |
191+
isSourceImpl(source, v)
192+
)
191193
}
192194

193195
Location getASelectedSinkLocation(DataFlow::Node sink) {
194196
exists(PointerArithmeticInstruction pai, Instruction deref |
195-
result = [pai, deref].getLocation() and
197+
result = [[pai, deref].getLocation(), sink.getLocation()] and
196198
isInvalidPointerDerefSink2(sink, deref, _) and
197199
isSink(sink, ArrayAddressToDerefConfig::TOverflowArithmetic(pai))
198200
)

0 commit comments

Comments
 (0)