CodeQL library for C/C++
codeql/cpp-all 2.0.1-dev (changelog, source)
Search

Module Buffer

Import path

import semmle.code.cpp.commons.Buffer

Imports

cpp

Provides classes and predicates for working with C/C++ code.

Predicates

getBufferSize

Get the size in bytes of the buffer pointed to by an expression (if this can be determined).

getBufferSizeProj

Same as getBufferSize, but with the why column projected away to prevent large duplications.

memberMayBeVarSize

Holds if v is a member variable of c that looks like it might be variable sized in practice. For example: struct myStruct { // c int amount; char data[1]; // v }; or struct myStruct { // c int amount; char data[]; // v }; This requires that v is an array of size 0 or 1, or that the array has no size.