mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
CPP: Fix the initialized array case in getBufferSize.
This commit is contained in:
@@ -58,6 +58,10 @@ int getBufferSize(Expr bufferExpr, Element why) {
|
||||
// buffer is an initialized array
|
||||
// e.g. int buffer[] = {1, 2, 3};
|
||||
why = bufferVar.getInitializer().getExpr() and
|
||||
(
|
||||
why instanceof AggregateLiteral or
|
||||
why instanceof StringLiteral
|
||||
) and
|
||||
result = why.(Expr).getType().(ArrayType).getSize() and
|
||||
not exists(bufferVar.getType().getUnspecifiedType().(ArrayType).getSize())
|
||||
) or exists(Class parentClass, VariableAccess parentPtr |
|
||||
|
||||
Reference in New Issue
Block a user