File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
cpp/ql/lib/semmle/code/cpp/commons Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,12 @@ private int isSource(Expr bufferExpr, Element why) {
106106 exists ( Variable bufferVar | bufferVar = bufferExpr .( VariableAccess ) .getTarget ( ) |
107107 // buffer is a fixed size array
108108 exists ( bufferVar .getUnspecifiedType ( ) .( ArrayType ) .getSize ( ) ) and
109- result = getSize ( bufferExpr ) and // more generous than .getSize() itself, when the array is a class field or similar.
109+ result =
110+ unique( int size | // more generous than .getSize() itself, when the array is a class field or similar.
111+ size = getSize ( bufferExpr )
112+ |
113+ size
114+ ) and
110115 why = bufferVar and
111116 not memberMayBeVarSize ( _, bufferVar ) and
112117 not exists ( BuiltInOperationBuiltInOffsetOf offsetof | offsetof .getAChild * ( ) = bufferExpr ) and
You can’t perform that action at this time.
0 commit comments