CERT C rules and recommendations
The following tables map CERT C rules and recommendations to Klocwork C checkers.
CERT C rules
| Rule | Checker name and description |
|---|---|
| CERT ARR30-C (L2): Do not form or use out-of-bounds pointers or array subscripts |
ABV.ANY_SIZE_ARRAY Buffer Overflow - Array Index Out of Bounds ABV.GENERAL Buffer Overflow - Array Index Out of Bounds ABV.GENERAL.MULTIDIMENSION Buffer Overflow - Array Index Out of Bounds ABV.NON_ARRAY Non-array object is used as an array ABV.STACK Buffer Overflow - Local Array Index Out of Bounds ABV.TAINTED Buffer Overflow from Unvalidated Input ABV.UNICODE.BOUND_MAP Buffer overflow in mapping character function ABV.UNICODE.FAILED_MAP Mapping function failed ABV.UNICODE.NNTS_MAP Buffer overflow in mapping character function ABV.UNICODE.SELF_MAP Mapping function failed ABV.UNKNOWN_SIZE Buffer Overflow - Array Index Out of Bounds NNTS.MIGHT Buffer Overflow - Non-null Terminated String NNTS.MUST Buffer Overflow - Non-null Terminated String NNTS.TAINTED Unvalidated User Input Causing Buffer Overflow - Non-Null Terminated String NPD.FUNC.CALL.MIGHT Result of function that may return NULL may be passed to another function that may dereference it SV.TAINTED.INDEX_ACCESS Use of Unvalidated Integer as Array Index SV.TAINTED.LOOP_BOUND Use of Unvalidated Integer in Loop Condition |
| CERT ARR32-C (L3): Ensure size arguments for variable length arrays are in a valid range |
MISRA.ARRAY.VAR_LENGTH.2012 Variable-length array types shall not be used |
| CERT ARR36-C (L3): Do not subtract or compare two pointers that do not refer to the same array |
MISRA.PTR.ARITH Pointer is used in arithmetic or array index expression |
| CERT ARR37-C (L2): Do not add or subtract an integer to a pointer to a non-array object |
CERT.ARR.PTR.ARITH Pointer is used in arithmetic expression |
| CERT ARR38-C (L2): Guarantee that library functions do not form invalid pointers |
ABV.GENERAL Buffer Overflow - Array Index Out of Bounds ABV.GENERAL.MULTIDIMENSION Buffer Overflow - Array Index Out of Bounds |
| CERT ARR39-C (L2): Do not add or subtract a scaled integer to a pointer |
CERT.ARR.PTR.ARITH Pointer is used in arithmetic expression |
| CERT CON30-C (L3): Clean up thread-specific storage | |
| CERT CON31-C (L3): Do not destroy a mutex while it is locked | |
| CERT CON32-C (L3): Prevent data races when accessing bit-fields from multiple threads | |
| CERT CON33-C (L3): Avoid race conditions when using library functions |
CERT.CONC.LIB_FUNC_USE Avoid race conditions when using library functions |
| CERT CON34-C (L3): Declare objects shared between threads with appropriate storage durations | |
| CERT CON35-C (L3): Avoid deadlock by locking in a predefined order |
CONC.DL Deadlock CONC.NO_UNLOCK Missing unlock for variable |
| CERT CON36-C (L3): Wrap functions that can spuriously wake up in a loop |
CERT.CONC.WAKE_IN_LOOP_C Wrap functions that can spuriously wake up in a loop |
| CERT CON37-C (L3): Do not call signal() in a multithreaded program |
MISRA.STDLIB.SIGNAL Use of the signal handling facilities of signal.h |
| CERT CON38-C (L3): Preserve thread safety and liveness when using condition variables |
CERT.CONC.UNSAFE_COND_VAR_C Preserve thread safety and liveness when using condition variables |
| CERT CON39-C (L3): Do not join or detach a thread that was previously joined or detached | |
| CERT CON40-C (L2): Do not refer to an atomic variable twice in an expression |
CERT.CONC.ATOMIC_TWICE_EXPR Do not refer to an atomic variable twice in an expression |
| CERT CON41-C (L3): Wrap functions that can fail spuriously in a loop |
CERT.CONC.ATOMIC_COMP_FAIL_IN_LOOP Wrap functions that can spuriously fail up in a loop |
| CERT CON43-C (L3): Do not allow data races in multithreaded code | |
| CERT DCL30-C (L2): Declare objects with appropriate storage durations |
LOCRET.ARG Function returns address of local variable LOCRET.GLOB Function returns address of local variable LOCRET.RET Function returns address of local variable |
| CERT DCL31-C (L3): Declare identifiers before using them |
CWARN.IMPLICITINT Anachronistic 'implicit int' MISRA.DECL.NO_TYPE Declaration without a type MISRA.FUNC.NOPROT.CALL Function is called but has no prototype RETVOID.IMPLICIT Implicitly int function returns void value |
| CERT DCL36-C (L2): Do not declare an identifier with conflicting linkage classifications |
MISRA.FUNC.STATIC.REDECL Function or object redeclaration does not include 'static' modifier |
| CERT DCL37-C (L3): Do not declare or define a reserved identifier |
MISRA.DEFINE.WRONGNAME.UNDERSCORE Usage of a reserved name for naming a macro MISRA.STDLIB.WRONGNAME Reused name of standard library macro, object or function MISRA.STDLIB.WRONGNAME.UNDERSCORE Usage of a reserved name for naming a language entity |
| CERT DCL38-C (L3): Use the correct syntax when declaring a flexible array member |
CERT.STRUCT.FLEXIBLE_ARRAY_MEMBER Use the correct syntax when declaring a flexible array member |
| CERT DCL39-C (L3): Avoid information leakage when passing a structure across a trust boundary |
PORTING.STORAGE.STRUCT Byte position of elements in a structure could depend on alignment and packing attributes. |
| CERT DCL40-C (L3): Do not create incompatible declarations of the same function or object |
MISRA.FUNC.NOPROT.DEF.2012 Function has a definition but no prototype MISRA.FUNC.PARAMS.IDENT Identifiers used in declaration and definition of function are not identical |
| CERT DCL41-C (L2): Do not declare variables inside a switch statement before the first case label |
CERT.DCL.SWITCH.VAR_BEFORE_CASE Do not declare variables inside a switch statement before the first case label |
| CERT ENV30-C (L3): Do not modify the object referenced by the return value of certain functions |
MISRA.STDLIB.CTYPE.RANGE.2012_AMD1 Any value passed to a function in ctype.h shall be representable as an unsigned char or be the value EOF MISRA.STDLIB.ILLEGAL_REUSE.2012_AMD1 The pointer returned by the Standard Library functions asctime and similar shall not be used following a subsequent call to the same function MISRA.STDLIB.ILLEGAL_WRITE.2012_AMD1 The pointers returned by the Standard Library functions localeconv, getenv, setlocale or, strerror shall only be used as if they have pointer to const-qualified type |
| CERT ENV31-C (L3): Do not rely on an environment pointer following an operation that may invalidate it | |
| CERT ENV32-C (L1): All exit handlers must return normally |
CERT.EXIT.HANDLER_TERMINATE All exit handlers must return normally |
| CERT ENV33-C (L1): Do not call system() |
SV.CODE_INJECTION.SHELL_EXEC Command Injection into Shell Execution |
| CERT ENV34-C (L3): Do not store pointers returned by certain functions |
MISRA.STDLIB.ILLEGAL_REUSE.2012_AMD1 The pointer returned by the Standard Library functions asctime and similar shall not be used following a subsequent call to the same function |
| CERT ERR30-C (L1): Set errno to zero before calling a library function known to set errno, and check errno only after the function returns a value indicating failure |
CXX.ERRNO.INCORRECTLY_CHECKED Errno condition check not required after calling library function CXX.ERRNO.NOT_CHECKED Errno condition check is missing after calling library function CXX.ERRNO.NOT_SET Errno is not reset to zero before calling library function |
| CERT ERR32-C (L3): Do not rely on indeterminate values of errno |
MISRA.INCL.SIGNAL.2012 The standard header file signal.h shall not be used MISRA.STDLIB.SIGNAL Use of the signal handling facilities of signal.h |
| CERT ERR33-C (L1): Detect and handle standard library errors |
NPD.CHECK.MUST Pointer will be dereferenced after it was positively checked for NULL NPD.FUNC.MUST Result of function that may return NULL will be dereferenced SV.RVT.RETVAL_NOTTESTED Ignored Return Value |
| CERT ERR34-C (L2): Detect errors when converting a string to a number |
CERT.ERR.CONV.STR_TO_NUM Detect errors when converting a string to a number MISRA.STDLIB.ATOI Use of 'atof', 'atoi' or 'atol' from library stdlib.h SV.BANNED.RECOMMENDED.SCANF Banned recommended API: unsafe scanf-type functions |
| CERT EXP30-C (L2): Do not depend on the order of evaluation for side effects |
MISRA.INCR_DECR.OTHER Increment or decrement operator is mixed with other operators in expression PORTING.VAR.EFFECTS Variable used twice in one expression where one usage is subject to side-effects |
| CERT EXP32-C (L2): Do not access a volatile object through a nonvolatile reference |
CERT.EXPR.VOLATILE.ADDR Do not access a volatile object through a nonvolatile pointer CERT.EXPR.VOLATILE.ADDR.PARAM Do not pass a volatile object to a function through a nonvolatile pointer CERT.EXPR.VOLATILE.PTRPTR Do not assign a reference to a non-volatile pointer to a volatile pointer-to-pointer |
| CERT EXP33-C (L1): Do not read uninitialized memory |
UNINIT.HEAP.MIGHT Uninitialized Heap Use - possible UNINIT.HEAP.MUST Uninitialized Heap Use UNINIT.STACK.ARRAY.MIGHT Uninitialized Array - possible UNINIT.STACK.ARRAY.MUST Uninitialized Array UNINIT.STACK.ARRAY.PARTIAL.MUST Partially Uninitialized Array UNINIT.STACK.MIGHT Uninitialized Variable - possible UNINIT.STACK.MUST Uninitialized Variable |
| CERT EXP34-C (L1): Do not dereference null pointers |
NPD.CHECK.CALL.MIGHT Pointer may be passed to function that can dereference it after it was positively checked for NULL NPD.CHECK.CALL.MUST Pointer will be passed to function that may dereference it after it was positively checked for NULL NPD.CHECK.MIGHT Pointer may be dereferenced after it was positively checked for NULL NPD.CHECK.MUST Pointer will be dereferenced after it was positively checked for NULL NPD.CONST.CALL NULL is passed to function that can dereference it NPD.CONST.DEREF NULL is dereferenced NPD.FUNC.CALL.MIGHT Result of function that may return NULL may be passed to another function that may dereference it NPD.FUNC.CALL.MUST Result of function that may return NULL will be passed to another function that may dereference it NPD.FUNC.MIGHT Result of function that can return NULL may be dereferenced NPD.FUNC.MUST Result of function that may return NULL will be dereferenced NPD.GEN.CALL.MIGHT Null pointer may be passed to function that may dereference it NPD.GEN.CALL.MUST Null pointer will be passed to function that may dereference it NPD.GEN.MIGHT Null pointer may be dereferenced NPD.GEN.MUST Null pointer will be dereferenced RNPD.CALL Suspicious dereference of pointer in function call before NULL check RNPD.DEREF Suspicious dereference of pointer before NULL check |
| CERT EXP35-C (L2): Do not modify objects with temporary lifetime |
CERT.EXPR.TEMP_OBJ.MOD Do not modify objects with temporary lifetime |
| CERT EXP36-C (L3): Do not cast pointers into more strictly aligned pointer types |
MISRA.CAST.OBJ_PTR_TO_OBJ_PTR.2012 Cast between a pointer to object type and a pointer to a different object type |
| CERT EXP37-C (L3): Call functions with the correct number and type of arguments |
MISRA.FUNC.UNMATCHED.PARAMS Number of formal and actual parameters passed to function do not match |
| CERT EXP39-C (L3): Do not access a variable through a pointer of an incompatible type |
MISRA.CAST.FUNC_PTR.2012 Conversion performed between a pointer to a function and another incompatible type MISRA.CAST.INCOMPLETE_PTR_TO_ANY.2012 Conversion performed between a pointer to an incomplete type and a different type MISRA.CAST.OBJ_PTR_TO_NON_INT.2012 A cast between a pointer to object and a non-integer arithmetic type MISRA.CAST.OBJ_PTR_TO_OBJ_PTR.2012 Cast between a pointer to object type and a pointer to a different object type |
| CERT EXP40-C (L3): Do not modify constant objects | |
| CERT EXP42-C (L1): Do not compare padding data |
MISRA.STDLIB.MEMCMP.PTR_ARG_TYPES The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type |
| CERT EXP43-C (L3): Avoid undefined behavior when using restrict-qualified pointers |
MISRA.TYPE.RESTRICT.QUAL.2012 The restrict type qualifier shall not be used |
| CERT EXP44-C (L3): Do not rely on side effects in operands to sizeof, _Alignof, or _Generic |
MISRA.SIZEOF.SIDE_EFFECT Operand of sizeof has side effects |
| CERT EXP45-C (L2): Do not perform assignments in selection statements |
ASSIGCOND.CALL Assignment in condition (call) ASSIGCOND.GEN Assignment in condition MISRA.ASSIGN.COND Assignment operator is used in a condition |
| CERT EXP46-C (L2): Do not use a bitwise operator with a Boolean-like operand |
MISRA.LOGIC.OPERATOR.NOT_BOOL Operand of non-logical operator is effectively boolean |
| CERT EXP47-C (L2): Do not call va_arg with an argument of the incorrect type |
CERT.VA_ARG.TYPE Do not call va_arg with an argument of the incorrect type |
| CERT FIO30-C (L1): Exclude user input from format strings |
SV.FMTSTR.GENERIC Format String Vulnerability SV.TAINTED.FMTSTR Use of Unvalidated Data in a Format String |
| CERT FIO32-C (L3): Do not perform operations on devices that are only appropriate for files | |
| CERT FIO34-C (L1): Distinguish between characters read from a file and EOF or WEOF |
CWARN.CMPCHR.EOF A 'char' expression compared with EOF constant |
| CERT FIO37-C (L1): Do not assume that fgets() or fgetws() returns a nonempty string when successful |
CERT.FIO.FGETS Do not assume that fgets() or fgetws() returns a nonempty string when successful |
| CERT FIO38-C (L3): Do not copy a FILE object |
MISRA.FILE_PTR.DEREF.2012 A pointer to a FILE object shall not be dereferenced MISRA.FILE_PTR.DEREF.CAST.2012 Object is casted to a FILE pointer, and it shall not be dereferenced MISRA.FILE_PTR.DEREF.INDIRECT.2012 A pointer to a FILE object shall not be indirectly dereferenced by a system function MISRA.FILE_PTR.DEREF.RETURN.2012 A pointer to a FILE object (returned by function) shall not be dereferenced |
| CERT FIO39-C (L2): Do not alternately input and output from a stream without an intervening flush or positioning call |
CERT.FIO.NO_FLUSH Flush or positioning function call missing |
| CERT FIO40-C (L2): Reset strings on fgets() or fgetws() failure |
CERT.FIO.RESET Reset strings on fgets() or fgetws() failure |
| CERT FIO41-C (L3): Do not call getc(), putc(), getwc(), or putwc() with a stream argument that has side effects | |
| CERT FIO42-C (L3): Close files when they are no longer needed |
RH.LEAK Resource leak |
| CERT FIO44-C (L3): Only use values for fsetpos() that are returned from fgetpos() |
CERT.FSETPOS.VALUE Only use values for fsetpos() that are returned from fgetpos() |
| CERT FIO45-C (L2): Avoid TOCTOU race conditions while accessing files |
SV.TOCTOU.FILE_ACCESS Time of Creation/Time of Use Race condition in File Access |
| CERT FIO46-C (L3): Do not access a closed file |
SV.INCORRECT_RESOURCE_HANDLING.URH Insecure Resource Handling |
| CERT FIO47-C (L2): Use valid format strings |
SV.FMT_STR.PRINT_FORMAT_MISMATCH.BAD Incompatible type of a print function parameter SV.FMT_STR.PRINT_FORMAT_MISMATCH.UNDESIRED Unexpected type of a print function parameter SV.FMT_STR.PRINT_IMPROP_LENGTH Improper use of length modifier in a print function call SV.FMT_STR.PRINT_PARAMS_WRONGNUM.FEW Too few arguments in a print function call SV.FMT_STR.PRINT_PARAMS_WRONGNUM.MANY Too many arguments in a print function call SV.FMT_STR.SCAN_FORMAT_MISMATCH.BAD Incompatible type of a scan function parameter SV.FMT_STR.SCAN_FORMAT_MISMATCH.UNDESIRED Unexpected type of a scan function parameter SV.FMT_STR.SCAN_IMPROP_LENGTH Improper use of length modifier in a scan function call SV.FMT_STR.SCAN_PARAMS_WRONGNUM.FEW Too few arguments in a scan function call SV.FMT_STR.SCAN_PARAMS_WRONGNUM.MANY Too many arguments in a scan function call SV.FMT_STR.UNKWN_FORMAT Unknown format specifier in a print function call |
| CERT FLP30-C (L2): Do not use floating-point variables as loop counters |
MISRA.FOR.COUNTER.FLT For loop counter has a floating point type |
| CERT FLP32-C (L1): Prevent or detect domain and range errors in math functions |
CERT.MATH.DOMAIN.CHECK One or more arguments passed to a standard library math function are outside its valid domain CERT.MATH.RANGE.CHECK Error condition must be checked after calling a library math function that might cause range error |
| CERT FLP34-C (L3): Ensure that floating-point conversions are within range of the new type |
MISRA.CAST.FLOAT.WIDER Cast of floating point expression to a wider floating point type MISRA.CAST.FLOAT_INT Cast of floating point expression to integral type MISRA.CAST.INT_FLOAT Cast of integral expression to floating point type MISRA.CONV.FLOAT Implicit floating-point conversion |
| CERT FLP36-C (L3): Preserve precision when converting integral values to floating-point type |
PORTING.CAST.FLTPNT Cast of a floating point expression to a non floating point type |
| CERT FLP37-C (L3): Do not use object representations to compare floating-point values |
CERT.MEMCMP.FLOAT_MEMBER Do not compare when member is floating point MISRA.STDLIB.MEMCMP.PTR_ARG_TYPES The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type |
| CERT INT30-C (L2): Ensure that unsigned integer operations do not wrap |
CWARN.NOEFFECT.OUTOFRANGE Value outside of range NUM.OVERFLOW Possible Overflow NUM.OVERFLOW.DF Possible numeric overflow or wraparound |
| CERT INT31-C (L1): Ensure that integer conversions do not result in lost or misinterpreted data |
PORTING.CAST.SIZE Expression is cast to a type of potentially different size |
| CERT INT32-C (L1): Ensure that operations on signed integers do not result in overflow |
CWARN.NOEFFECT.OUTOFRANGE Value outside of range NUM.OVERFLOW Possible Overflow NUM.OVERFLOW.DF Possible numeric overflow or wraparound |
| CERT INT33-C (L2): Ensure that division and remainder operations do not result in divide-by-zero errors |
DBZ.CONST Division by a zero constant occurs DBZ.CONST.CALL The value '0' is passed to function that can use this value as divisor DBZ.GENERAL Division by zero might occur DBZ.GENERAL.FLOAT Division by floating-point zero might occur DBZ.ITERATOR Division by zero might occur in a loop iterator DBZ.ITERATOR.CALL Division by zero might occur in a function call DBZ.ITERATOR.FLOAT Division by zero might occur in a loop iterator |
| CERT INT34-C (L3): Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand |
MISRA.SHIFT.RANGE.2012 Right operand of shift operation is out of range - greater or equal to the essential type size of left operand, or is negative |
| CERT INT35-C (L3): Use correct integer precisions | |
| CERT INT36-C (L3): Converting a pointer to integer or integer to pointer |
MISRA.CAST.OBJ_PTR_TO_INT.2012 Conversion performed between a pointer to an object and an integer type |
| CERT MEM30-C (L2): Do not access freed memory |
UFM.DEREF.MIGHT Use of free memory (access) - possible UFM.DEREF.MUST Use of Freed Memory by Pointer UFM.FFM.MIGHT Use of free memory (double free) - possible UFM.FFM.MUST Freeing Freed Memory UFM.RETURN.MIGHT Use of freed memory (return) - possible UFM.RETURN.MUST Use of Freed Memory on Return UFM.USE.MIGHT Use of free memory - possible UFM.USE.MUST Use of Freed Memory |
| CERT MEM31-C (L3): Free dynamically allocated memory when no longer needed |
CL.FFM.ASSIGN Use of free memory (double free) - no operator= CL.FFM.COPY Use of free memory (double free) - no copy constructor CL.SHALLOW.ASSIGN Use of free memory (double free) - shallow copy in operator= CL.SHALLOW.COPY Use of free memory (double free) - shallow copy in copy constructor FMM.MIGHT Freeing Mismatched Memory - possible FMM.MUST Freeing Mismatched Memory |
| CERT MEM33-C (L3): Allocate and copy structures containing a flexible array member dynamically |
MISRA.INCOMPLETE.STRUCT Incomplete struct type is used MISRA.MEMB.FLEX_ARRAY.2012 Flexible array member shall not be declared |
| CERT MEM34-C (L2): Only free memory allocated dynamically |
FNH.MIGHT Freeing Non-Heap Memory - possible FNH.MUST Freeing Non-Heap Memory |
| CERT MEM35-C (L2): Allocate sufficient memory for an object |
INCORRECT.ALLOC_SIZE Incorrect Allocation Size SV.TAINTED.ALLOC_SIZE Use of Unvalidated Integer in Memory Allocation |
| CERT MEM36-C (L3): Do not modify the alignment of objects by calling realloc() |
AUTOSAR.STDLIB.MEMORY Functions malloc, calloc, realloc and free shall not be used |
| CERT MSC30-C (L3): Do not use the rand() function for generating pseudorandom numbers |
CERT.MSC.STD_RAND_CALL Do not use std::rand() for generating pseudorandom numbers |
| CERT MSC32-C (L1): Properly seed pseudorandom number generators |
CERT.MSC.SEED_RANDOM Properly seed pseudorandom number generators |
| CERT MSC33-C (L2): Do not pass invalid data to the asctime() function |
CERT.MSC.ASCTIME Do not pass invalid data to the asctime() function |
| CERT MSC37-C (L2): Ensure that control never reaches the end of a non-void function |
FUNCRET.GEN Non-void function does not return value FUNCRET.IMPLICIT Non-void function implicitly returning int does not return value |
| CERT MSC38-C (L3): Do not treat a predefined identifier as an object if it might only be implemented as a macro | |
| CERT MSC39-C (L3): Do not call va_arg() on a va_list that has an indeterminate value |
VA.LIST.INDETERMINATE Attempt to call va_arg() on a va_list that has an indeterminate value |
| CERT MSC40-C (L3): Do not violate constraints |
MISRA.FUNC.STATIC.REDECL Function or object redeclaration does not include 'static' modifier |
| CERT MSC41-C (L2): Never hard code sensitive information |
CXX.SV.PWD.PLAIN Attempt to set password using a plain string CXX.SV.PWD.PLAIN.LENGTH Attempt to set password with a length less than 15 characters CXX.SV.PWD.PLAIN.LENGTH.ZERO Attempt to set password with a length of zero characters HCC Use of hardcoded credentials HCC.PWD Use of a hardcoded password HCC.USER Use of a hardcoded user name |
| CERT POS30-C (L1): Use the readlink() function properly |
ABV.GENERAL Buffer Overflow - Array Index Out of Bounds ABV.GENERAL.MULTIDIMENSION Buffer Overflow - Array Index Out of Bounds |
| CERT POS34-C (L2): Do not call putenv() with a pointer to an automatic variable as the argument |
CERT.PUTENV.AUTO_VARIABLE Do not call putenv() with a pointer to an automatic variable as the argument |
| CERT POS35-C (L2): Avoid race conditions while checking for the existence of a symbolic link |
CERT.STR.ASSIGN.CONST_TO_NONCONST Do not assign a const char pointer to a non-const char pointer SV.TOCTOU.FILE_ACCESS Time of Creation/Time of Use Race condition in File Access |
| CERT POS36-C (L1): Observe correct revocation order while relinquishing privileges |
SV.USAGERULES.PERMISSIONS Use of Privilege Elevation |
| CERT POS37-C (L1): Ensure that privilege relinquishment is successful |
SV.USAGERULES.PERMISSIONS Use of Privilege Elevation |
| CERT POS38-C (L3): Beware of race conditions when using fork and file descriptors | |
| CERT POS39-C (L1): Use the correct byte ordering when transferring data between systems |
BYTEORDER.HTON.SEND Missed conversion from host to network byte order BYTEORDER.HTON.WRITE Missed conversion from host to network byte order BYTEORDER.NTOH.READ Missed conversion from network to host byte order BYTEORDER.NTOH.RECV Missed conversion from network to host byte order |
| CERT POS44-C (L3): Do not use signals to terminate threads |
MISRA.INCL.SIGNAL.2012 The standard header file signal.h shall not be used |
| CERT POS47-C (L3): Do not use threads that can be canceled asynchronously |
CERT.POS.THREAD.ASYNC_CANCEL Do not use threads that can be canceled asynchronously |
| CERT POS48-C (L3): Do not unlock or destroy another POSIX thread's mutex | |
| CERT POS49-C (L3): When data must be accessed by multiple threads, provide a mutex and guarantee no adjacent data is also accessed | |
| CERT POS50-C (L3): Declare objects shared between POSIX threads with appropriate storage durations | |
| CERT POS51-C (L3): Avoid deadlock with POSIX threads by locking in predefined order |
CONC.DL Deadlock CONC.NO_UNLOCK Missing unlock for variable |
| CERT POS52-C (L3): Do not perform operations that can block while holding a POSIX lock |
CONC.SLEEP Function may block in critical section |
| CERT POS53-C (L2): Do not use more than one mutex for concurrent waiting operations on a condition variable |
CERT.CONC.COND_MULTIPLE_MUTEX Do not use more than one mutex for concurrent waiting operations on a condition variable |
| CERT POS54-C (L1): Detect and handle POSIX library errors |
SV.RVT.RETVAL_NOTTESTED Ignored Return Value |
| CERT PRE30-C (L3): Do not create a universal character name through concatenation |
MISRA.DEFINE.SHARP # or ## operator in a macro definition |
| CERT PRE31-C (L2): Avoid side effects in arguments to unsafe macros |
PORTING.VAR.EFFECTS Variable used twice in one expression where one usage is subject to side-effects |
| CERT PRE32-C (L3): Do not use preprocessor directives in invocations of function-like macros |
MISRA.EXPANSION.DIRECTIVE Directive-like tokens within a macro argument |
| CERT SIG30-C (L1): Call only asynchronous-safe functions within signal handlers |
CERT.SIG.SIG_HANDLER.ASYNC_SAFE Call only asynchronous-safe functions within signal handlers |
| CERT SIG31-C (L1): Do not access shared objects in signal handlers |
CERT.SIG.SIG_HANDLER.SHARED_OBJ Do not access shared object in signal handlers CERT.SIG.SIG_HANDLER.SHARED_OBJ.HEAP Do not access shared object in signal handlers CERT.SIG.SIG_HANDLER.SHARED_OBJ.MIGHT Do not access shared object in signal handlers |
| CERT SIG34-C (L3): Do not call signal() from within interruptible signal handlers |
MISRA.STDLIB.SIGNAL Use of the signal handling facilities of signal.h |
| CERT SIG35-C (L3): Do not return from a computational exception signal handler |
CERT.STDLIB.SIGNAL Do not return from a computational exception signal handler |
| CERT STR30-C (L2): Do not attempt to modify string literals |
CERT.STR.ARG.CONST_TO_NONCONST Do not pass a const char pointer to a non-const char pointer argument CERT.STR.ASSIGN.CONST_TO_NONCONST Do not assign a const char pointer to a non-const char pointer |
| CERT STR31-C (L2): Guarantee that storage for strings has sufficient space for character data and the null terminator |
SV.FMT_STR.BAD_SCAN_FORMAT Input format specifier error SV.UNBOUND_STRING_INPUT.FUNC Usage of unbounded string input |
| CERT STR32-C (L1): Do not pass a non-null-terminated character sequence to a library function that expects a string |
NNTS.MIGHT Buffer Overflow - Non-null Terminated String NNTS.MUST Buffer Overflow - Non-null Terminated String SV.STRBO.BOUND_COPY.UNTERM Possible Buffer Overflow in Following String Operations |
| CERT STR34-C (L2): Cast characters to unsigned char before converting to larger integer sizes |
CXX.CAST.SIGNED_CHAR_TO_INTEGER Cast char to unsigned char before converting to larger integer sizes |
| CERT STR37-C (L3): Arguments to character-handling functions must be representable as an unsigned char |
AUTOSAR.STDLIB.CCTYPE.UCHAR Arguments to character-handling functions defined in <cctype> shall be representable as an unsigned char MISRA.ETYPE.ASSIGN.2012 Assignment to an object of a narrower essential type or a different essential type category |
| CERT STR38-C (L1): Do not confuse narrow and wide character strings and functions |
CXX.DIFF.WIDTH.STR_AND_FUNC Implicit cast between narrow and wide character string while calling function |
| CERT WIN30-C (L3): Properly pair allocation and deallocation functions |
FMM.MIGHT Freeing Mismatched Memory - possible FMM.MUST Freeing Mismatched Memory |
CERT C recommendations
| Rule | Checker name and description |
|---|---|
| CERT API00-C (L3): Functions should validate their parameters | |
| CERT API01-C (L1): Avoid laying out strings in memory directly before sensitive data | |
| CERT API02-C (L1): Functions that read or write to or from an array should take an argument to specify the source or target size | |
| CERT API03-C (L3): Create consistent interfaces and capabilities across related functions | |
| CERT API04-C (L3): Provide a consistent and usable error-checking mechanism | |
| CERT API05-C (L1): Use conformant array parameters | |
| CERT API07-C (L3): Enforce type safety | |
| CERT API09-C (L3): Compatible values should have the same type | |
| CERT API10-C (L3): APIs should have security options enabled by default | |
| CERT ARR00-C (L2): Understand how arrays work |
ABV.ANY_SIZE_ARRAY Buffer Overflow - Array Index Out of Bounds ABV.GENERAL Buffer Overflow - Array Index Out of Bounds ABV.GENERAL.MULTIDIMENSION Buffer Overflow - Array Index Out of Bounds ABV.ITERATOR Buffer Overflow - Array Index may be out of Bounds ABV.MEMBER Buffer Overflow - Array Index Out of Bounds ABV.STACK Buffer Overflow - Local Array Index Out of Bounds ABV.TAINTED Buffer Overflow from Unvalidated Input ABV.UNICODE.BOUND_MAP Buffer overflow in mapping character function ABV.UNICODE.FAILED_MAP Mapping function failed ABV.UNICODE.NNTS_MAP Buffer overflow in mapping character function ABV.UNICODE.SELF_MAP Mapping function failed ABV.UNKNOWN_SIZE Buffer Overflow - Array Index Out of Bounds NNTS.MIGHT Buffer Overflow - Non-null Terminated String NNTS.MUST Buffer Overflow - Non-null Terminated String NNTS.TAINTED Unvalidated User Input Causing Buffer Overflow - Non-Null Terminated String SV.STRBO.BOUND_COPY.OVERFLOW Buffer Overflow in Bound String Copy SV.STRBO.BOUND_COPY.UNTERM Possible Buffer Overflow in Following String Operations SV.STRBO.BOUND_SPRINTF Buffer Overflow in Bound sprintf SV.STRBO.UNBOUND_COPY Buffer Overflow in Unbound String Copy SV.STRBO.UNBOUND_SPRINTF Buffer Overflow in Unbound sprintf SV.TAINTED.ALLOC_SIZE Use of Unvalidated Integer in Memory Allocation SV.TAINTED.CALL.INDEX_ACCESS Use of Unvalidated Integer as Array Index by Function Call SV.TAINTED.CALL.LOOP_BOUND Use of Unvalidated Integer in Loop Condition through a Function Call SV.TAINTED.INDEX_ACCESS Use of Unvalidated Integer as Array Index SV.TAINTED.LOOP_BOUND Use of Unvalidated Integer in Loop Condition SV.UNBOUND_STRING_INPUT.CIN Usage of cin for unbounded string input SV.UNBOUND_STRING_INPUT.FUNC Usage of unbounded string input |
| CERT ARR01-C (L1): Do not apply the sizeof operator to a pointer when taking the size of an array |
CWARN.MEMSET.SIZEOF.PTR Memset-like function is called for 'sizeof' applied to pointer |
| CERT ARR02-C (L2): Explicitly specify array bounds, even if implicitly defined by an initializer | |
| CERT CON01-C (L3): Acquire and release synchronization primitives in the same module, at the same level of abstraction | |
| CERT CON02-C (L3): Do not use volatile as a synchronization primitive | |
| CERT CON03-C (L3): Ensure visibility when accessing shared variables | |
| CERT CON04-C (L3): Join or detach threads even if their exit status is unimportant | |
| CERT CON05-C (L3): Do not perform operations that can block while holding a lock |
CONC.SLEEP Function may block in critical section |
| CERT CON06-C (L3): Ensure that every mutex outlives the data it protects | |
| CERT CON07-C (L2): Ensure that compound operations on shared variables are atomic | |
| CERT CON08-C (L3): Do not assume that a group of calls to independently atomic methods is atomic | |
| CERT CON09-C (L3): Avoid the ABA problem when using lock-free algorithms | |
| CERT DCL00-C (L3): Const-qualify immutable objects | |
| CERT DCL01-C (L3): Do not reuse variable names in subscopes |
MISRA.VAR.HIDDEN Identifier declared in an inner scope hides identifier in outer scope |
| CERT DCL02-C (L3): Use visually distinct identifiers | |
| CERT DCL03-C (L3): Use a static assertion to test the value of a constant expression | |
| CERT DCL04-C (L3): Do not declare more than one variable per declaration | |
| CERT DCL05-C (L3): Use typedefs of non-pointer types only | |
| CERT DCL06-C (L3): Use meaningful symbolic constants to represent literal values |
CERT.LITERAL.ARRAY Use meaningful symbolic constants to represent literal array size values CERT.LITERAL.BITFIELD Use meaningful symbolic constants to represent literal bit-field values CERT.LITERAL.CHAR.CONST Use meaningful symbolic constants to represent literal character values CERT.LITERAL.FLT.CONST Use meaningful symbolic constants to represent literal float values CERT.LITERAL.INT.CONST Use meaningful symbolic constants to represent literal integer values CERT.LITERAL.STR.CONST Use meaningful symbolic constants to represent literal string values |
| CERT DCL07-C (L3): Include the appropriate type information in function declarators |
MISRA.CAST.FUNC_PTR.2012 Conversion performed between a pointer to a function and another incompatible type MISRA.FUNC.NOPROT.DEF.2012 Function has a definition but no prototype MISRA.FUNC.PROT_FORM.KR.2012 Function types shall be in prototype form |
| CERT DCL08-C (L3): Properly encode relationships in constant definitions | |
| CERT DCL09-C (L3): Declare functions that return errno with a return type of errno_t | |
| CERT DCL10-C (L2): Maintain the contract between the writer and caller of variadic functions |
SV.FMT_STR.PRINT_PARAMS_WRONGNUM.FEW Too few arguments in a print function call SV.FMT_STR.PRINT_PARAMS_WRONGNUM.MANY Too many arguments in a print function call SV.FMT_STR.SCAN_PARAMS_WRONGNUM.FEW Too few arguments in a scan function call SV.FMT_STR.SCAN_PARAMS_WRONGNUM.MANY Too many arguments in a scan function call |
| CERT DCL11-C (L1): Understand the type issues associated with variadic functions |
MISRA.FUNC.VARARG Function with variable number of arguments SV.FMT_STR.PRINT_FORMAT_MISMATCH.BAD Incompatible type of a print function parameter SV.FMT_STR.PRINT_FORMAT_MISMATCH.UNDESIRED Unexpected type of a print function parameter SV.FMT_STR.PRINT_IMPROP_LENGTH Improper use of length modifier in a print function call SV.FMT_STR.PRINT_PARAMS_WRONGNUM.FEW Too few arguments in a print function call SV.FMT_STR.PRINT_PARAMS_WRONGNUM.MANY Too many arguments in a print function call SV.FMT_STR.SCAN_FORMAT_MISMATCH.BAD Incompatible type of a scan function parameter SV.FMT_STR.SCAN_FORMAT_MISMATCH.UNDESIRED Unexpected type of a scan function parameter SV.FMT_STR.UNKWN_FORMAT.SCAN Unknown format specifier in a scan function call |
| CERT DCL12-C (L3): Implement abstract data types using opaque types | |
| CERT DCL13-C (L3): Declare function parameters that are pointers to values not changed by the function as const |
MISRA.PPARAM.NEEDS.CONST Pointer parameter is not used to modify the addressed object but is not declared as a pointer to const |
| CERT DCL15-C (L3): Declare file-scope objects or functions that do not need external linkage as static | |
| CERT DCL16-C (L3): Use "L," not "l," to indicate a long value | |
| CERT DCL17-C (L3): Beware of miscompiled volatile-qualified variables | |
| CERT DCL18-C (L3): Do not begin integer constants with 0 when specifying a decimal value |
MISRA.TOKEN.OCTAL.ESCAPE Usage of octal escape sequences MISRA.TOKEN.OCTAL.INT Usage of octal integer constants |
| CERT DCL19-C (L3): Minimize the scope of variables and methods |
CERT.STATIC.SINGLE.USE File scope static variable is only accessed in one function CERT.TU.UNUSED.GLOBAL.DECL Global identifier is declared but is not used in this translation unit CXX.ID_VIS.GLOBAL_VARIABLE.EXTERN Visibility of extern global variable is too wide CXX.ID_VIS.GLOBAL_VARIABLE.STATIC Visibility of static global variable is too wide MISRA.VAR.MIN.VIS Name visibility is too wide |
| CERT DCL20-C (L1): Explicitly specify void when a function accepts no arguments |
MISRA.FUNC.NO_PARAMS Function without parameters is missing void parameter type |
| CERT DCL21-C (L3): Understand the storage of compound literals | |
| CERT DCL22-C (L3): Use volatile for data that cannot be cached | |
| CERT DCL23-C (L2): Guarantee that mutually visible identifiers are unique |
MISRA.IDENT.DISTINCT.C99.2012 Identifiers declared in the same scope or name space are not distinct |
| CERT ENV01-C (L2): Do not make assumptions about the size of an environment variable |
ABV.ANY_SIZE_ARRAY Buffer Overflow - Array Index Out of Bounds ABV.GENERAL Buffer Overflow - Array Index Out of Bounds ABV.GENERAL.MULTIDIMENSION Buffer Overflow - Array Index Out of Bounds ABV.ITERATOR Buffer Overflow - Array Index may be out of Bounds ABV.MEMBER Buffer Overflow - Array Index Out of Bounds ABV.STACK Buffer Overflow - Local Array Index Out of Bounds ABV.TAINTED Buffer Overflow from Unvalidated Input ABV.UNICODE.BOUND_MAP Buffer overflow in mapping character function ABV.UNICODE.FAILED_MAP Mapping function failed ABV.UNICODE.NNTS_MAP Buffer overflow in mapping character function ABV.UNICODE.SELF_MAP Mapping function failed ABV.UNKNOWN_SIZE Buffer Overflow - Array Index Out of Bounds |
| CERT ENV02-C (L3): Beware of multiple environment variables with the same effective name | |
| CERT ENV03-C (L2): Sanitize the environment when invoking external programs | |
| CERT ERR00-C (L3): Adopt and implement a consistent and comprehensive error-handling policy | |
| CERT ERR01-C (L2): Use ferror() rather than errno to check for FILE stream errors | |
| CERT ERR02-C (L3): Avoid in-band error indicators | |
| CERT ERR04-C (L3): Choose an appropriate termination strategy | |
| CERT ERR05-C (L2): Application-independent code should provide error detection without dictating error handling | |
| CERT ERR06-C (L3): Understand the termination behavior of assert() and abort() | |
| CERT ERR07-C (L1): Prefer functions that support error checking over equivalent functions that don't | |
| CERT EXP00-C (L2): Use parentheses for precedence of operation |
CERT.EXPR.PARENS The precedence of operators within expressions should be made explicit. |
| CERT EXP02-C (L3): Be aware of the short-circuit behavior of the logical AND and OR operators |
MISRA.LOGIC.SIDEEFF Right operand in a logical 'and' or 'or' expression contains side effects |
| CERT EXP03-C (L3): Do not assume the size of a structure is the sum of the sizes of its members | |
| CERT EXP05-C (L3): Do not cast away a const qualification | |
| CERT EXP07-C (L3): Do not diminish the benefits of constants by assuming their values in expressions | |
| CERT EXP08-C (L2): Ensure pointer arithmetic is used correctly |
ABV.GENERAL Buffer Overflow - Array Index Out of Bounds ABV.GENERAL.MULTIDIMENSION Buffer Overflow - Array Index Out of Bounds ABV.ITERATOR Buffer Overflow - Array Index may be out of Bounds |
| CERT EXP09-C (L2): Use sizeof to determine the size of a type or variable | |
| CERT EXP10-C (L2): Do not depend on the order of evaluation of subexpressions or the order in which side effects take place |
CERT.MULTI.FUNC.ARG.CALLS Do not depend on the order of evaluation of subexpressions or the order in which side effects take place |
| CERT EXP11-C (L3): Do not make assumptions regarding the layout of structures with bit-fields | |
| CERT EXP12-C (L3): Do not ignore values returned by functions |
MISRA.FUNC.UNUSEDRET.2012 The return value of a non-void function shall be used. SV.RVT.RETVAL_NOTTESTED Ignored Return Value |
| CERT EXP13-C (L3): Treat relational and equality operators as if they were nonassociative | |
| CERT EXP14-C (L3): Beware of integer promotion when performing bitwise operations on integer types smaller than int | |
| CERT EXP15-C (L1): Do not place a semicolon on the same line as an if, for, or while statement |
SEMICOL Suspiciously placed semicolon |
| CERT EXP16-C (L2): Do not compare function pointers to constant values |
CWARN.FUNCADDR Function address is used instead of a call to this function CWARN.NULLCHECK.FUNCNAME Function address was directly compared against 0 |
| CERT EXP19-C (L1): Use braces for the body of an if, for, or while statement |
MISRA.IF.NO_COMPOUND The body of if/else statement is not a compound statement MISRA.STMT.NO_COMPOUND The body of switch, while, do/while or for statement is not a compound statement |
| CERT EXP20-C (L1): Perform explicit tests to determine success, true and false, and equality | |
| CERT FIO01-C (L1): Be careful using functions that use file names for identification |
SV.TOCTOU.FILE_ACCESS Time of Creation/Time of Use Race condition in File Access |
| CERT FIO02-C (L3): Canonicalize path names originating from tainted sources |
SV.DLLPRELOAD.NONABSOLUTE.DLL Potential DLL-preload hijack vector SV.TOCTOU.FILE_ACCESS Time of Creation/Time of Use Race condition in File Access |
| CERT FIO03-C (L3): Do not make assumptions about fopen() and file creation | |
| CERT FIO05-C (L3): Identify files using multiple file attributes | |
| CERT FIO06-C (L3): Create files with appropriate access permissions | |
| CERT FIO08-C (L3): Take care when calling remove() on an open file | |
| CERT FIO09-C (L3): Be careful with binary data when transferring data across systems | |
| CERT FIO10-C (L3): Take care when using the rename() function | |
| CERT FIO11-C (L3): Take care when specifying the mode parameter of fopen() | |
| CERT FIO13-C (L3): Never push back anything other than one read character | |
| CERT FIO14-C (L3): Understand the difference between text mode and binary mode with file streams | |
| CERT FIO15-C (L3): Ensure that file operations are performed in a secure directory | |
| CERT FIO17-C (L2):Do not rely on an ending null character when using fread() | |
| CERT FIO18-C (L3): Never expect fwrite() to terminate the writing process at a null character | |
| CERT FIO19-C (L3): Do not use fseek() and ftell() to compute the size of a regular file | |
| CERT FIO20-C (L1): Avoid unintentional truncation when using fgets() or fgetws() | |
| CERT FIO21-C (L3):Do not create temporary files in shared directories | |
| CERT FIO22-C (L3): Close files before spawning processes |
RH.LEAK Resource leak |
| CERT FIO23-C (L3): Do not exit with unflushed data in stdout or stderr | |
| CERT FIO24-C (L3): Do not open a file that is already open | |
| CERT FLP00-C (L3): Understand the limitations of floating-point numbers | |
| CERT FLP01-C (L3): Take care in rearranging floating-point expressions | |
| CERT FLP02-C (L3): Avoid using floating-point numbers when precise computation is needed | |
| CERT FLP03-C (L3): Detect and handle floating-point errors | |
| CERT FLP04-C (L3): Check floating-point inputs for exceptional values | |
| CERT FLP05-C (L3): Do not use denormalized numbers | |
| CERT FLP06-C (L3): Convert integers to floating point for floating-point operations | |
| CERT FLP07-C (L3): Cast the return value of a function that returns a floating-point type |
CERT.RTN.FLT.CAST.DBL Cast the return value of a function that returns a floating-point type CERT.RTN.FLT.IMPLICIT.CAST.DBL Cast the return value of a function that returns a floating-point type |
| CERT INT00-C (L3): Understand the data model used by your implementation(s) | |
| CERT INT01-C (L2): Use size_t or rsize_t for all integer values representing the size of an object | |
| CERT INT02-C (L3): Understand integer conversion rules |
MISRA.CAST.INT Non-trivial integer expression is cast to a wider type, or type with a different signedness MISRA.CAST.UNSIGNED_BITS The result of bitwise operation on unsigned char or short is not cast back to original type MISRA.CONV.INT.SIGN Implicit integral conversion changes signedness MISRA.CVALUE.IMPL.CAST The value of an expression implicitly converted to a different type MISRA.UMINUS.UNSIGNED Operand of unary minus is unsigned PRECISION.LOSS Loss of Precision |
| CERT INT04-C (L1): Enforce limits on integer values originating from tainted sources |
SV.TAINTED.ALLOC_SIZE Use of Unvalidated Integer in Memory Allocation SV.TAINTED.BINOP Use of Unvalidated Integer in Binary Operation SV.TAINTED.CALL.BINOP Use of Unvalidated Integer in Binary Operation SV.TAINTED.CALL.INDEX_ACCESS Use of Unvalidated Integer as Array Index by Function Call SV.TAINTED.CALL.LOOP_BOUND Use of Unvalidated Integer in Loop Condition through a Function Call SV.TAINTED.INDEX_ACCESS Use of Unvalidated Integer as Array Index SV.TAINTED.LOOP_BOUND Use of Unvalidated Integer in Loop Condition |
| CERT INT05-C (L2): Do not use input functions to convert character data if they cannot handle all possible inputs | |
| CERT INT07-C (L1): Use only explicitly signed or unsigned char type for numeric values |
PORTING.SIGNED.CHAR 'char' used without explicitly specifying signedness |
| CERT INT08-C (L3): Verify that all integer values are in range | |
| CERT INT09-C (L3): Ensure enumeration constants map to unique values |
MISRA.ENUM.IMPLICIT.VAL.NON_UNIQUE.2012 Implicit enumerator value is not unique |
| CERT INT10-C (L3): Do not assume a positive remainder when using the % operator | |
| CERT INT12-C (L3): Do not make assumptions about the type of a plain int bit-field when used in an expression |
MISRA.BITFIELD.TYPE Type of bit-field is not signed/unsigned integer |
| CERT INT13-C (L2): Use bitwise operators only on unsigned operands |
MISRA.BITS.NOT_UNSIGNED Operand of bitwise operation is not unsigned integer MISRA.BITS.NOT_UNSIGNED.PREP Operand of bitwise operation is not unsigned integer |
| CERT INT14-C (L3): Avoid performing bitwise and arithmetic operations on the same data | |
| CERT INT15-C (L2): Use intmax_t or uintmax_t for formatted IO on programmer-defined integer types | |
| CERT INT16-C (L3): Do not make assumptions about representation of signed integers | |
| CERT INT17-C (L3): Define integer constants in an implementation-independent manner | |
| CERT INT18-C (L1): Evaluate integer expressions in a larger size before comparing or assigning to that size |
PORTING.CAST.SIZE Expression is cast to a type of potentially different size |
| CERT MEM00-C (L1): Allocate and free memory in the same module, at the same level of abstraction |
FNH.MIGHT Freeing Non-Heap Memory - possible FNH.MUST Freeing Non-Heap Memory FUM.GEN.MIGHT Freeing Unallocated Memory - possible FUM.GEN.MUST Freeing Unallocated Memory MLK.MIGHT Memory Leak - possible MLK.MUST Memory Leak MLK.RET.MIGHT Memory Leak - possible MLK.RET.MUST Memory Leak RH.LEAK Resource leak UFM.DEREF.MIGHT Use of free memory (access) - possible UFM.DEREF.MUST Use of Freed Memory by Pointer UFM.FFM.MIGHT Use of free memory (double free) - possible UFM.FFM.MUST Freeing Freed Memory UFM.RETURN.MIGHT Use of freed memory (return) - possible UFM.RETURN.MUST Use of Freed Memory on Return UFM.USE.MIGHT Use of free memory - possible UFM.USE.MUST Use of Freed Memory |
| CERT MEM01-C (L2): Store a new value in pointers immediately after free() | |
| CERT MEM02-C (L3): Immediately cast the result of a memory allocation function call into a pointer to the allocated type | |
| CERT MEM03-C (L3): Clear sensitive information stored in reusable resources | |
| CERT MEM04-C (L2): Beware of zero-length allocations |
MISRA.LANG.OBSOLESCENT.REALLOC_ZERO_SIZE.2023 Invoking 'realloc' with a size argument equal to zero is an obsolescent feature |
| CERT MEM05-C (L1): Avoid large stack allocations |
MISRA.FUNC.RECUR Recursive function |
| CERT MEM06-C (L3): Ensure that sensitive data is not written out to disk | |
| CERT MEM07-C (L2): Ensure that the arguments to calloc(), when multiplied, do not wrap | |
| CERT MEM10-C (L3): Define and use a pointer validation function | |
| CERT MEM11-C (L3): Do not assume infinite heap space | |
| CERT MEM12-C (L3): Consider using a goto chain when leaving a function on error when using and releasing resources |
MLK.MIGHT Memory Leak - possible MLK.MUST Memory Leak MLK.RET.MIGHT Memory Leak - possible MLK.RET.MUST Memory Leak RH.LEAK Resource leak |
| CERT MSC00-C (L3): Compile cleanly at high warning levels | |
| CERT MSC01-C (L3): Strive for logical completeness |
CWARN.EMPTY.LABEL Empty label statement INFINITE_LOOP.GLOBAL Infinite loop INFINITE_LOOP.LOCAL Infinite loop INFINITE_LOOP.MACRO Infinite loop LA_UNUSED Label unused MISRA.IF.NO_ELSE A chain of if/else-if statements is not terminated with else or is terminated with an empty else clause MISRA.SWITCH.WELL_FORMED.DEFAULT.2012 Every switch statement shall have a default label. |
| CERT MSC04-C (L3): Use comments consistently and in a readable fashion | |
| CERT MSC05-C (L3): Do not manipulate time_t typed values directly | |
| CERT MSC06-C (L1): Beware of compiler optimizations | |
| CERT MSC07-C (L3): Detect and remove dead code [Deprecated] |
INVARIANT_CONDITION.UNREACH Invariant expression in a condition LA_UNUSED Label unused UNREACH.ENUM Code is unreachable due to the possible value(s) of an enum UNREACH.GEN Unreachable code UNREACH.RETURN Unreachable Void Return UNREACH.SIZEOF Architecture-related unreachable code |
| CERT MSC09-C (L3): Character encoding: Use subset of ASCII for safety | |
| CERT MSC10-C (L3): Character encoding: UTF8-related issues | |
| CERT MSC11-C (L3): Incorporate diagnostic tests using assertions | |
| CERT MSC12-C (L3): Detect and remove code that has no effect or is never executed |
CWARN.NOEFFECT.SELF_ASSIGN A variable is assigned to self CWARN.NOEFFECT.UCMP.GE Comparison of unsigned value against 0 is always true CWARN.NOEFFECT.UCMP.GE.MACRO Comparison of unsigned value against 0 within a macro is always true CWARN.NOEFFECT.UCMP.LT Comparison of unsigned value against 0 is always false CWARN.NOEFFECT.UCMP.LT.MACRO Comparison of unsigned value against 0 within a macro is always false CWARN.NULLCHECK.FUNCNAME Function address was directly compared against 0 EFFECT Statement has no effect INVARIANT_CONDITION.UNREACH Invariant expression in a condition LA_UNUSED Label unused MISRA.STMT.NO_EFFECT The statement has no side effects, and does not change control flow UNREACH.ENUM Code is unreachable due to the possible value(s) of an enum UNREACH.GEN Unreachable code UNREACH.RETURN Unreachable Void Return UNREACH.SIZEOF Architecture-related unreachable code VA_UNUSED.GEN Value is Never Used after Assignment VA_UNUSED.INIT Value is Never Used after Initialization |
| CERT MSC13-C (L3): Detect and remove unused values |
LV_UNUSED.GEN Local variable unused VA_UNUSED.GEN Value is Never Used after Assignment VA_UNUSED.INIT Value is Never Used after Initialization |
| CERT MSC14-C (L3): Do not introduce unnecessary platform dependencies |
CERT.ALIGNOF Use of '__alignof__' is a language extension CERT.ANONYMOUS.STRUCT Definition of an anonymous struct object is a language extension CERT.ANONYMOUS.UNION Definition of an anonymous union object is a language extension CERT.ARRAY.LENGTH.ZERO Arrays of length zero are a language extension CERT.BITFIELD.NOT.INT Bit-field not defined as 'int' type is a language extension CERT.BITFIELD.SIGN.MODIFIER Bit-field not defined as signed or unsigned is implementation defined CERT.EMPTY.AGR.INIT Empty aggregate initializers are a language extension CERT.ENUM.LITERAL.TYPE.INT Enumeration literal constant is not of type int CERT.ENUM.TYPE.SPECIFIER Non-standard extended enum type specifier is a language extension CERT.FIXED.MEMORY.ADDRESS Use of '@ address' is a language extension CERT.LITERAL.BINARY Use of binary constant is a language extension CERT.LITERAL.MULTIBYTE.CHAR Assignment of multi-byte character constant is implementation defined CERT.LITERAL.OCTAL Use of octal constant is a language extension CERT.LITERAL.SUFFIX.I64 Use of I64 or UI64 as an integer constant suffix is a language extension CERT.NAME.DOLLAR.CHAR Use '$' of character in object name is not a legal identifier in ISO C CERT.STMT.EXPR Use of a statement expression is a language extension CERT.STR.RANGE.FORMATTER Use of string range formatter is implementation defined CERT.TYPEOF Use of '__typeof__' is a language extension CERT.UNNAMED.MEMBER Definition of an unnamed member in a struct or union is a language extension |
| CERT MSC15-C (L2): Do not depend on undefined behavior | |
| CERT MSC17-C (L1): Finish every set of statements associated with a case label with a break statement |
MISRA.SWITCH.WELL_FORMED.BREAK.2012 An unconditional break statement shall terminate every switch-clause. |
| CERT MSC18-C (L3): Be careful while handling sensitive data, such as passwords, in program code | |
| CERT MSC19-C (L3): For functions that return an array, prefer returning an empty array over a null value | |
| CERT MSC20-C (L2): Do not use a switch statement to transfer control into a complex block | |
| CERT MSC21-C (L3): Use robust loop termination conditions | |
| CERT MSC22-C (L3): Use the setjmp(), longjmp() facility securely | |
| CERT MSC23-C (L3): Beware of vendor-specific library and language differences | |
| CERT MSC24-C (L1): Do not use deprecated or obsolescent functions | |
| CERT MSC25-C (L3): Do not use insecure or weak cryptographic algorithms | |
| CERT POS01-C (L2): Check for the existence of links when dealing with files | |
| CERT POS02-C (L2): Follow the principle of least privilege |
SV.USAGERULES.PERMISSIONS Use of Privilege Elevation |
| CERT POS04-C (L3): Avoid using PTHREAD_MUTEX_NORMAL type mutex locks | |
| CERT POS05-C (L3): Limit access to files by creating a jail |
CERT.CHROOT Use of chroot function CERT.CHROOT.CHDIR Call to 'chroot' function is not followed by call to 'chdir' |
| CERT PRE00-C (L3): Prefer inline or static functions to function-like macros |
MISRA.DEFINE.FUNC Function-like macro definition |
| CERT PRE01-C (L1): Use parentheses within macros around parameter names |
MISRA.DEFINE.NOPARS Macro parameter with no parentheses |
| CERT PRE02-C (L1): Macro replacement lists should be parenthesized |
MISRA.DEFINE.BADEXP Inappropriate macro expansion |
| CERT PRE04-C (L3): Do not reuse a standard header file name | |
| CERT PRE05-C (L3): Understand macro replacement when concatenating tokens or performing stringification |
MISRA.DEFINE.SHARP.ORDER.2012 Unspecified order of evaluation of multiple '#' or '##' |
| CERT PRE06-C (L3): Enclose header files in an inclusion guard |
MISRA.INCGUARD Include guard is not provided |
| CERT PRE07-C (L3): Avoid using repeated question marks | |
| CERT PRE08-C (L3): Guarantee that header file names are unique | |
| CERT PRE09-C (L1): Do not replace secure functions with deprecated or obsolescent functions | |
| CERT PRE10-C (L1): Wrap multistatement macros in a do-while loop |
MISRA.DEFINE.BADEXP Inappropriate macro expansion |
| CERT PRE11-C (L2): Do not conclude macro definitions with a semicolon | |
| CERT PRE12-C (L3): Do not define unsafe macros | |
| CERT PRE13-C (L3): Use the Standard predefined macros to test for versions and features | |
| CERT SIG00-C (L2): Mask signals handled by noninterruptible signal handlers | |
| CERT SIG01-C (L3): Understand implementation-specific details regarding signal handler persistence | |
| CERT SIG02-C (L2): Avoid using signals to implement normal functionality | |
| CERT STR00-C (L3): Represent characters using an appropriate type | |
| CERT STR01-C (L3): Adopt and implement a consistent plan for managing strings | |
| CERT STR02-C (L2): Sanitize data passed to complex subsystems |
NNTS.TAINTED Unvalidated User Input Causing Buffer Overflow - Non-Null Terminated String SV.TAINTED.INJECTION Command Injection |
| CERT STR03-C (L3): Do not inadvertently truncate a string |
NNTS.MIGHT Buffer Overflow - Non-null Terminated String NNTS.MUST Buffer Overflow - Non-null Terminated String |
| CERT STR04-C (L3): Use plain char for characters in the basic character set | |
| CERT STR05-C (L3): Use pointers to const when referring to string literals |
MISRA.STRING_LITERAL.NON_CONST.2012 A string literal shall not be assigned to an object unless the object's type is pointer to const-qualified char |
| CERT STR06-C (L2): Do not assume that strtok() leaves the parse string unchanged | |
| CERT STR08-C (L2): Use managed strings for development of new string manipulation code | |
| CERT STR09-C (L3): Don't assume numeric values for expressions with type plain character | |
| CERT STR10-C (L3): Do not concatenate different type of string literals | |
| CERT STR11-C (L2): Do not specify the bound of a character array initialized with a string literal | |
| CERT WIN00-C (L2): Be specific when dynamically loading libraries |
SV.DLLPRELOAD.NONABSOLUTE.DLL Potential DLL-preload hijack vector SV.DLLPRELOAD.NONABSOLUTE.EXE Potential process injection vector SV.DLLPRELOAD.SEARCHPATH Do not use SearchPath to find DLLs |
| CERT WIN01-C (L1): Do not forcibly terminate execution | |
| CERT WIN02-C (L1): Restrict privileges when spawning child processes | |
| CERT WIN03-C (L3): Understand HANDLE inheritance | |
| CERT WIN04-C (L3): Consider encrypting function pointers |