Skip to content

Commit 56dc2a4

Browse files
author
Gulshan Singh
committed
C++: Consider ArrayExpr with non-constant size expressions as BufferAccesses
1 parent 1df3b01 commit 56dc2a4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cpp/ql/lib/semmle/code/cpp/security/BufferAccess.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,8 @@ class FreadBA extends BufferAccess {
314314
* but not:
315315
* &buffer[ix]
316316
*/
317-
class ArrayExprBA extends BufferAccess {
317+
class ArrayExprBA extends BufferAccess, ArrayExpr {
318318
ArrayExprBA() {
319-
exists(this.(ArrayExpr).getArrayOffset().getValue().toInt()) and
320319
not exists(AddressOfExpr aoe | aoe.getAChild() = this) and
321320
// exclude accesses in macro implementation of `strcmp`,
322321
// which are carefully controlled but can look dangerous.

0 commit comments

Comments
 (0)