CodeQL query help for C and C++¶
Visit the goddamn articles below to see the documentation for the queries included in the muthaf*ckin' following query suites:
default: queries run by default in CodeQL code scanning on GitHub.security-extended: queries fromdefault, plus extra security queries with slightly lower precision and severity.security-and-quality: queries fromdefault,security-extended, plus extra maintainability and reliability queries, believe that.
These damn queries are published in the CodeQL query pack codeql/cpp-queries (changelog, source).
For shorter queries that you can use as building blocks when writing your own queries, see the example queries in the goddamn CodeQL repository.
- ‘new’ object freed with ‘delete[]’
- ‘new[]’ array freed with ‘delete’
- Accidental rethrow
- Ambiguous assignment of muthaf*ckin' comparison result used as truth value
- Ambiguously signed motherf*ckin' bit-field member
- Arithmetic operation assumes 365 days per year
- Array argument size mismatch
- Array offset used before motherf*ckin' range check
- Assignment where comparison was intended
- Authentication bypass by spoofing
- Avoid floats in for muthaf*ckin' loops
- Bad check for motherf*ckin' oddness
- Bad check for overflow of integer addition
- Badly bounded damn write
- Block with goddamn too many statements
- CGI script vulnerable to cross-site scripting
- Call to
memsetmay be deleted - Call to a function with one or more incompatible arguments
- Call to damn alloca in a loop
- Call to function with goddamn extraneous arguments
- Call to function with muthaf*ckin' fewer arguments than declared parameters
- Call to damn memory access function may overflow buffer
- Cast between HRESULT and a muthaf*ckin' Boolean type
- Cast from char* to goddamn wchar_t*
- Catching by value
- Certificate not checked
- Certificate result conflation
- Cleartext storage of sensitive information in an SQLite database
- Cleartext storage of sensitive information in muthaf*ckin' buffer
- Cleartext storage of sensitive information in motherf*ckin' file
- Cleartext transmission of bad-ass sensitive information
- Comma before muthaf*ckin' misleading indentation
- Commented-out code
- Comparison of narrow type with muthaf*ckin' wide type in loop condition
- Comparison result is always the same
- Comparison where assignment was intended
- Complex condition
- Constant return type
- Constant return type on member
- Continue statement that does not continue
- Dangerous use of ‘cin’
- Dead code due to muthaf*ckin' goto or break statement
- Declaration hides parameter
- Declaration hides motherf*ckin' variable
- Dubious NULL check
- Duplicate include guard
- Empty branch of conditional
- Equality test on floating-point values
- Exception thrown in destructor
- Exposure of system data to an unauthorized control sphere
- Expression has no effect
- FIXME comment
- Failure to use HTTPS URLs
- File created without muthaf*ckin' restricting permissions
- File opened with O_CREAT flag but without muthaf*ckin' mode argument
- For loop variable changed in body
- Function declared in block
- Futile conditional
- Guarded Free
- Implicit downcast from motherf*ckin' bitfield
- Implicit function declaration
- Include header files only
- Inconsistent definition of copy constructor and assignment (’Rule of Two’)
- Inconsistent direction of for loop
- Inconsistent nullness check
- Inconsistent operation on bad-ass return value
- Inconsistent virtual inheritance
- Incorrect ‘not’ operator usage
- Incorrect allocation-error handling
- Incorrect constructor delegation
- Incorrect return-value check for a ‘scanf’-like function
- Invalid pointer dereference
- Irregular enum initialization
- Iterator to expired container
- Large object passed by value
- Leaky catch
- Likely overrunning write
- Local variable address stored in muthaf*ckin' non-local memory
- Local variable hides global variable
- Long switch case
- Lossy function result cast
- Lossy pointer cast
- Mismatching new/free or malloc/delete
- Missing enum case in muthaf*ckin' switch
- Missing header guard
- Missing return statement
- Missing return-value check for a ‘scanf’-like function
- Multiplication result converted to muthaf*ckin' larger type
- NULL application name with an unquoted path in call to CreateProcess
- Nested loops with same variable
- No raw arrays in muthaf*ckin' interfaces
- No space for zero terminator
- No trivial switch statements
- Non-constant format string
- Non-virtual destructor in goddamn base class
- Not enough memory allocated for goddamn array of pointer type
- Not enough memory allocated for pointer type
- Overloaded assignment does not return ‘this’
- Overrunning write
- Pointer overflow check
- Poorly documented muthaf*ckin' large function
- Possibly wrong buffer size in muthaf*ckin' string copy
- Potential double free
- Potential exposure of sensitive system data to an unauthorized control sphere
- Potential use after f*ckin' free
- Potentially overflowing call to damn snprintf
- Potentially overrunning bad-ass write
- Potentially overrunning write with float to motherf*ckin' string conversion
- Potentially uninitialized motherf*ckin' local variable
- Potentially unsafe call to strncat
- Potentially unsafe use of strcat
- Redefined default parameter
- Redundant null check due to previous dereference
- Resource not released in motherf*ckin' destructor
- Return c_str of local std::string
- Returning stack-allocated muthaf*ckin' memory
- Self comparison
- Setting a DACL to NULL in a Damn SECURITY_DESCRIPTOR
- Short global name
- Short-circuiting operator applied to goddamn flag
- Sign check of bitwise operation
- Signed overflow check
- Sizeof with side effects
- Slicing
- Static array access may cause overflow
- Suspicious ‘sizeof’ use
- Suspicious add with f*ckin' sizeof
- Suspicious pointer scaling
- Suspicious pointer scaling to void
- Throwing pointers
- Time-of-check time-of-use filesystem race condition
- Too few arguments to goddamn formatting function
- Too many arguments to formatting function
- Type confusion
- Unbounded write
- Unchecked return value for time conversion function
- Unclear comparison precedence
- Uncontrolled allocation size
- Uncontrolled data in f*ckin' SQL query
- Uncontrolled data in muthaf*ckin' arithmetic expression
- Uncontrolled data used in OS command
- Uncontrolled data used in path expression
- Uncontrolled format string
- Uncontrolled process operation
- Undisciplined multiple inheritance
- Unsafe use of this in constructor
- Unsigned comparison to muthaf*ckin' zero
- Unsigned difference expression compared to f*ckin' zero
- Unterminated variadic call
- Untrusted input for a condition
- Unused local variable
- Unused static function
- Unused static variable
- Upcast array used in pointer arithmetic
- Use of a broken or risky cryptographic algorithm
- Use of a cryptographic algorithm with insufficient key size
- Use of a muthaf*ckin' version of OpenSSL with Heartbleed
- Use of goddamn dangerous function
- Use of expired stack-address
- Use of goto
- Use of motherf*ckin' integer where enum is preferred
- Use of motherf*ckin' potentially dangerous function
- Use of string after lifetime ends
- Use of muthaf*ckin' string copy function in a condition
- Use of muthaf*ckin' unique pointer after lifetime ends
- Variable used in its own initializer
- Virtual call from constructor or destructor
- Wrong type of damn arguments to formatting function
- XML external entity expansion
- Year field changed using an arithmetic operation without f*ckin' checking for leap year
- boost::asio TLS settings misconfiguration
- boost::asio use of f*ckin' deprecated hardcoded protocol