Skip to content

Commit d489c12

Browse files
authored
Update BufferAccessWithIncorrectLengthValue.ql
1 parent 475e36e commit d489c12

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-805/BufferAccessWithIncorrectLengthValue.ql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ predicate numberArgument(Function f, int bpos, int spos) {
6262

6363
from FunctionCall fc
6464
where
65-
exists(ArrayType at, int b, int s, Variable vr |
66-
numberArgument(fc.getTarget(), b, s) and
67-
fc.getArgument(s).getValue().toInt() > at.getByteSize() and
68-
vr.getADeclarationEntry().getType() = at and
69-
fc.getArgument(b).(VariableAccess).getTarget() = vr
65+
exists(ArrayType array, int bufArgPos, int sizeArgPos |
66+
numberArgument(fc.getTarget(), bufArgPos, sizeArgPos) and
67+
fc.getArgument(sizeArgPos).getValue().toInt() > array.getByteSize() and
68+
fc.getArgument(bufArgPos).(VariableAccess).getTarget().getADeclarationEntry().getType() = array
7069
)
7170
select fc,
7271
"Access beyond the bounds of the allocated memory is possible, the size argument used is greater than the size of the buffer."

0 commit comments

Comments
 (0)