Skip to content

Commit 98ba308

Browse files
committed
CPP: Use memberMayBeVarSize.
1 parent c527f9c commit 98ba308

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/ql/src/Likely Bugs/Conversion/ArrayArgSizeMismatch.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* @tags reliability
1010
*/
1111
import cpp
12+
import semmle.code.cpp.commons.Buffer
1213

1314
from Function f, FunctionCall c, int i, ArrayType argType, ArrayType paramType, int a, int b
1415
where f = c.getTarget() and
@@ -18,7 +19,7 @@ where f = c.getTarget() and
1819
b = paramType.getArraySize() and
1920
argType.getBaseType().getSize() = paramType.getBaseType().getSize() and
2021
a < b and
21-
a > 0 and
22+
not memberMayBeVarSize(_, c.getArgument(i).(VariableAccess).getTarget()) and
2223
// filter out results for inconsistent declarations
2324
strictcount(f.getParameter(i).getType().getSize()) = 1
2425
select c.getArgument(i), "Array of size " + a +

0 commit comments

Comments
 (0)