CPP: Use memberMayBeVarSize.

This commit is contained in:
Geoffrey White
2019-01-25 16:40:11 +00:00
parent c527f9c90c
commit 98ba308207

View File

@@ -9,6 +9,7 @@
* @tags reliability
*/
import cpp
import semmle.code.cpp.commons.Buffer
from Function f, FunctionCall c, int i, ArrayType argType, ArrayType paramType, int a, int b
where f = c.getTarget() and
@@ -18,7 +19,7 @@ where f = c.getTarget() and
b = paramType.getArraySize() and
argType.getBaseType().getSize() = paramType.getBaseType().getSize() and
a < b and
a > 0 and
not memberMayBeVarSize(_, c.getArgument(i).(VariableAccess).getTarget()) and
// filter out results for inconsistent declarations
strictcount(f.getParameter(i).getType().getSize()) = 1
select c.getArgument(i), "Array of size " + a +