Regelreferenz

MISRA C:2023 & CERT C-Regeln

Jede Regel, die Provadyne erkennt, generiert direkt aus dem Regelkatalog des Analyzers selbst — sodass diese Seite niemals von dem abweicht, was das Tool tatsächlich meldet. CWE-Befunde verlinken zu MITRE.

MISRA C:2023 · 133 Regeln

Die Kategorie spiegelt MISRAs eigene Klassifizierung wider: mandatory, required oder advisory.

1.2advisoryLanguage extensions should not be used
1.4requiredEmergent language features shall not be used
2.2requiredThere shall be no dead code
2.3advisoryProject should not contain unused type declarations
2.4advisoryProject should not contain unused tag declarations
2.5advisoryProject should not contain unused macro declarations
2.7advisoryFunction should not contain unused parameters
3.1requiredCharacter sequences /* and // shall not appear within a comment
4.1requiredOctal and hexadecimal escape sequences shall be terminated
4.2advisoryTrigraphs should not be used
5.1requiredExternal identifiers shall be distinct
5.2requiredIdentifiers declared in the same scope and name space shall be distinct
5.4requiredMacro identifiers shall be distinct
5.5requiredIdentifiers shall be distinct from macro names
5.6requiredTypedef name shall be a unique identifier
5.7requiredTag name shall be a unique identifier
5.8requiredIdentifiers that define objects or functions with external linkage shall be unique
5.9advisoryIdentifiers that define objects or functions with internal linkage should be unique
6.1requiredBit-fields shall only be declared with an appropriate type
6.2requiredSingle-bit named bit fields shall not be of a signed type
7.1requiredOctal constants shall not be used
7.2requiredA u or U suffix shall be applied to all integer constants of unsigned type
7.3requiredThe lowercase letter l shall not be used in any literal suffix
7.4requiredString literal shall not be assigned to an object unless its type is pointer to const-qualified char
8.1requiredTypes shall be explicitly specified in declarations and definitions
8.2requiredFunction types shall be in prototype form with named parameters
8.4requiredCompatible declaration required for objects/functions with external linkage
8.5requiredExternal objects and functions declared in one header file only
8.6requiredIdentifier with external linkage shall have exactly one external definition
8.7advisoryExternal linkage limited to objects used in more than one translation unit
8.8requiredStatic storage class specifier on all non-definition declarations of file scope
8.9advisoryObjects should be defined at block scope if referenced only within one function
8.10requiredInline functions shall be declared with static storage class
8.11advisoryExplicit size specified when declaring arrays with external linkage
8.12requiredWithin an enumerator list, the value of implicitly-specified enumeration constants shall be unique
8.13advisoryPointer parameter should point to const-qualified type when object is not modified
8.14requiredThe restrict type qualifier shall not be used
9.2requiredInitializer for an aggregate or union shall be enclosed in braces
9.3requiredArrays shall not be partially initialized
9.4requiredAn element of an object shall not be initialized more than once
9.5requiredWhere designated initializers are used, array size shall be specified explicitly
10.1requiredOperands shall not be of inappropriate essential type for the operator
10.2requiredExpressions of essentially character type shall not be used as operands of certain operators
10.3requiredAssigned value shall not be wider or of different essential type category
10.4requiredBoth operands of operator in usual arithmetic conversions shall have same essential type
10.5advisoryCast from one essential type category to another should be explicit
10.6requiredValue of composite expression shall not be assigned to wider essential type
10.7requiredComposite expression operand shall not have wider essential type than the other operand
10.8requiredComposite expression shall not be cast to different essential type category
11.1requiredNo conversion between function pointer type and any other type
11.2requiredNo conversion between pointer to incomplete type and other pointer types
11.3requiredCast shall not be performed between pointer to object and pointer to different object type
11.4advisoryConversion between object pointer and integer type should not be performed
11.5advisoryConversion from void pointer to object pointer type should not be performed
11.6requiredCast shall not be performed between void pointer and arithmetic type
11.7requiredCast shall not be performed between pointer-to-object and non-integer arithmetic type
11.8requiredCast shall not remove const or volatile qualification from pointed-to type
11.9requiredMacro NULL shall be the only permitted form of integer null pointer constant
12.1advisoryPrecedence of operators within an expression should be made explicit
12.2requiredRight hand operand of a shift operator shall be within the defined range
12.3advisoryComma operator should not be used
12.4advisoryEvaluation of constant expressions should not lead to unsigned integer wrap-around
13.1requiredInitializer lists shall not contain persistent side effects
13.3advisoryExpressions containing increment or decrement should not have other potential side effects
13.4advisoryResult of an assignment operator should not be used
13.5requiredRight hand operand of logical && or || shall not contain persistent side effects
13.6mandatoryOperand of sizeof shall not contain any expression with potential side effects
14.1requiredLoop counter shall not have essentially floating type
14.2requiredFor statement shall be well-formed with single loop counter
14.4requiredControlling expression of if/while/for/do shall be essentially Boolean
15.1advisorygoto statement should not be used
15.2requiredgoto label referenced by goto shall appear later in same function body
15.3requiredgoto label referenced by goto shall be in enclosing block
15.4advisorySingle break or goto for loop termination outside normal exit
15.5advisoryFunction should have a single point of exit at the end
15.6requiredBody of iteration/selection statement shall be compound statement
15.7requiredAll if-else if constructs shall be terminated with a final else clause
16.1requiredAll switch statements shall be well-formed
16.2requiredSwitch label shall only appear at the most-closely-enclosing compound statement of the switch
16.3requiredUnconditional break statement shall terminate every switch-clause
16.4requiredEvery switch statement shall have a default label
16.5requiredDefault label shall appear as either the first or last switch label
16.6requiredEvery switch statement shall have at least two switch-clauses
16.7requiredSwitch expression shall not have essentially Boolean type
17.1requiredMacros defined in stdarg.h shall not be used
17.2requiredFunctions shall not call themselves directly or indirectly
17.3mandatoryFunction shall not be declared implicitly
17.4mandatoryAll exit paths from a function with non-void return type shall have explicit return
17.5advisoryFunction argument corresponding to parameter declared as array shall have appropriate size
17.6mandatoryArray declarator with static shall not appear in function parameter
17.7requiredReturn value of non-void function shall be used by the caller
17.8advisoryFunction parameter should not be modified
18.4advisoryThe +, -, += and -= operators should not be applied to expressions of pointer type
18.5advisoryDeclarations should contain no more than two levels of pointer nesting
18.7requiredFlexible array members shall not be declared
18.8requiredVariable-length array types shall not be used
19.2advisoryThe union keyword should not be used
20.1advisory#include directives should only be preceded by preprocessor directives or comments
20.2required', ", or \ characters and the /* or // sequences shall not occur in a header file name
20.3required#include directive shall be followed by either a <filename> or "filename" sequence
20.4requiredMacro shall not be defined with the same name as a keyword
20.5advisory#undef should not be used
20.7requiredExpressions resulting from macro parameter expansion shall be enclosed in parentheses
20.8requiredControlling expression of #if or #elif preprocessing directive shall evaluate to 0 or 1
20.9requiredAll identifiers in controlling expression of #if or #elif shall be #defined before evaluation
20.10advisory# and ## preprocessor operators should not be used
20.11requiredMacro parameter immediately following # operator shall not also be followed by a ## operator
20.12requiredMacro parameter used as operand to # or ## operators shall not itself be subject to further macro replacement
20.13requiredLine whose first token is # shall be a valid preprocessing directive
20.14requiredAll #else, #elif and #endif directives shall reside in same file as corresponding #if/#ifdef/#ifndef
21.1required#define and #undef shall not be used on a reserved identifier or reserved macro name
21.2requiredReserved identifier or reserved macro name shall not be declared
21.3requiredMemory allocation and deallocation functions of stdlib.h shall not be used
21.4requiredStandard header file setjmp.h shall not be used
21.5requiredStandard header file signal.h shall not be used
21.6requiredStandard Library input/output routines of stdio.h shall not be used
21.7requiredatof, atoi, atol and atoll functions of stdlib.h shall not be used
21.8requiredLibrary functions abort, exit, getenv and system of stdlib.h shall not be used
21.9requiredLibrary functions bsearch and qsort of stdlib.h shall not be used
21.10requiredStandard Library time and date functions of time.h shall not be used
21.11requiredStandard header file tgmath.h shall not be used
21.12advisoryException handling features of fenv.h should not be used
21.14requiredStandard Library function memcmp shall not be used to compare null-terminated strings
21.15requiredPointer arguments to memcpy, memmove and memcmp shall be pointers to qualified or unqualified versions of compatible types
21.16requiredPointer arguments to memcmp shall point to either a pointer type, essentially signed type, essentially unsigned type, essentially Boolean or essentially enum type
21.19mandatoryPointers returned by localeconv, getenv, setlocale or strerror shall only be used as pointer-to-const-qualified type
21.20mandatoryPointer returned by asctime, ctime, gmtime, localtime, localeconv, getenv, setlocale or strerror shall not be used after a subsequent call to the same function
21.21requiredStandard Library function system of stdlib.h shall not be used
22.5mandatoryPointer to FILE object shall not be dereferenced
22.7requiredMacro EOF shall only be compared with unmodified return value from any Standard Library function capable of returning EOF
22.8requiredValue of errno shall be set to zero prior to a call to an errno-setting function
22.9requiredValue of errno shall be tested against zero after calling an errno-setting function
22.10requiredValue of errno shall only be tested when the last function called was an errno-setting function

SEI CERT C · 38 erkannte Regeln

CERT C-Befunde werden aus den zugrunde liegenden Prüfungen abgeleitet. Der Regeltext wird vom SEI gepflegt — jede Regel verlinkt zum offiziellen Standard.

ARR01-CCERT CSEI CERT C rule — full text at SEI
ARR30-CCERT CSEI CERT C rule — full text at SEI
ARR32-CCERT CSEI CERT C rule — full text at SEI
ARR36-CCERT CSEI CERT C rule — full text at SEI
ARR38-CCERT CSEI CERT C rule — full text at SEI
ARR39-CCERT CSEI CERT C rule — full text at SEI
CON40-CCERT CSEI CERT C rule — full text at SEI
DCL30-CCERT CSEI CERT C rule — full text at SEI
ERR33-CCERT CSEI CERT C rule — full text at SEI
EXP30-CCERT CSEI CERT C rule — full text at SEI
EXP33-CCERT CSEI CERT C rule — full text at SEI
EXP34-CCERT CSEI CERT C rule — full text at SEI
EXP36-CCERT CSEI CERT C rule — full text at SEI
EXP37-CCERT CSEI CERT C rule — full text at SEI
EXP44-CCERT CSEI CERT C rule — full text at SEI
FIO30-CCERT CSEI CERT C rule — full text at SEI
FIO39-CCERT CSEI CERT C rule — full text at SEI
FIO42-CCERT CSEI CERT C rule — full text at SEI
FIO46-CCERT CSEI CERT C rule — full text at SEI
FIO47-CCERT CSEI CERT C rule — full text at SEI
FLP32-CCERT CSEI CERT C rule — full text at SEI
FLP34-CCERT CSEI CERT C rule — full text at SEI
INT30-CCERT CSEI CERT C rule — full text at SEI
INT31-CCERT CSEI CERT C rule — full text at SEI
INT32-CCERT CSEI CERT C rule — full text at SEI
INT33-CCERT CSEI CERT C rule — full text at SEI
INT34-CCERT CSEI CERT C rule — full text at SEI
INT36-CCERT CSEI CERT C rule — full text at SEI
MEM30-CCERT CSEI CERT C rule — full text at SEI
MEM31-CCERT CSEI CERT C rule — full text at SEI
MEM34-CCERT CSEI CERT C rule — full text at SEI
MEM35-CCERT CSEI CERT C rule — full text at SEI
MSC37-CCERT CSEI CERT C rule — full text at SEI
MSC40-CCERT CSEI CERT C rule — full text at SEI
STR30-CCERT CSEI CERT C rule — full text at SEI
STR31-CCERT CSEI CERT C rule — full text at SEI
STR32-CCERT CSEI CERT C rule — full text at SEI
STR34-CCERT CSEI CERT C rule — full text at SEI
Keine Regel entspricht diesem Filter.

CWE. Befunde, die mit einer CWE-ID gekennzeichnet sind (z. B. CWE-476), verlinken direkt zur kanonischen Definition unter cwe.mitre.org, sodass sie hier nicht dupliziert werden.