SEI CERT C enforcement

Summary Total
(a) Total Number of Rules 119
(b) Total Number of ‘Not Statically Enforceable’ Rules (Assisted/Unassisted) 0
(c) Total Number of Enforceable Rules (a-b) 119
(d) Total Number of Enforced Rules 100
(e) Total Number of Unenforced Rules 19
(f) Enforce Rules Percentage (d/c) 84%
(g) Unenforced Rules Percentage (e/c) 16%
Rule Type Rule Description Level Enforced Associated Checkers
Rule 50 - POSIX(POS) POS30-C Use the readlink() function properly. L1 Yes ABV.GENERAL ABV.GENERAL.MULTIDIMENSION
Rule 50 - POSIX(POS) POS34-C Do not call putenv() with a pointer to an automatic variable as the argument. L2 Yes CERT.PUTENV.AUTO_VARIABLE
Rule 50 - POSIX(POS) POS35-C Avoid race conditions while checking for the existence of a symbolic link. L1 Yes CERT.STR.ASSIGN.CONST_TO_NONCONST SV.TOCTOU.FILE_ACCESS
Rule 50 - POSIX(POS) POS36-C Observe correct revocation order while relinquishing privileges. L1 Yes SV.USAGERULES.PERMISSIONS
Rule 50 - POSIX(POS) POS37-C Ensure that privilege relinquishment is successful. L1 Yes SV.USAGERULES.PERMISSIONS
Rule 50 - POSIX(POS) POS38-C Beware of race conditions when using fork and file descriptors. L3 No
Rule 50 - POSIX(POS) POS39-C Use the correct byte ordering when transferring data between systems. L1 Yes BYTEORDER.HTON.SEND BYTEORDER.HTON.WRITE BYTEORDER.NTOH.READ BYTEORDER.NTOH.RECV
Rule 50 - POSIX(POS) POS44-C Do not use signals to terminate threads. L2 Yes MISRA.INCL.SIGNAL.2012
Rule 50 - POSIX(POS) POS47-C Do not use threads that can be canceled asynchronously. L1 Yes CERT.POS.THREAD.ASYNC_CANCEL
Rule 50 - POSIX(POS) POS48-C Do not unlock or destroy another POSIX thread's mutex. L3 No
Rule 50 - POSIX(POS) POS49-C When data must be accessed by multiple threads, provide a mutex and guarantee no adjacent data is also accessed. L2 No
Rule 50 - POSIX(POS) POS50-C Declare objects shared between POSIX threads with appropriate storage durations. L3 No
Rule 50 - POSIX(POS) POS51-C Avoid deadlock with POSIX threads by locking in predefined order. L3 Yes CONC.DL CONC.NO_UNLOCK
Rule 50 - POSIX(POS) POS52-C Do not perform operations that can block while holding a POSIX lock. L3 Yes CONC.SLEEP
Rule 50 - POSIX(POS) POS53-C Do not use more than one mutex for concurrent waiting operations on a condition variable. L3 No
Rule 50 - POSIX(POS) POS54-C Detect and handle POSIX library errors. L1 Yes SV.RVT.RETVAL_NOTTESTED
Rule 01 - Preprocessors (PRE) PRE30-C Do not create a universal character name through concatenation. L3 Yes MISRA.DEFINE.SHARP
Rule 01 - Preprocessors (PRE) PRE31-C Avoid side effects in arguments to unsafe macros. L3 Yes PORTING.VAR.EFFECTS
Rule 01 - Preprocessors (PRE) PRE32-C Do not use preprocessor directives in invocations of function-like macros. L3 Yes MISRA.EXPANSION.DIRECTIVE
Rule 02 - Declarations and Initialization(DCL) DCL30-C Declare objects with appropriate storage durations. L2 Yes LOCRET.ARG LOCRET.GLOB LOCRET.RET
Rule 02 - Declarations and Initialization(DCL) DCL31-C Declare identifiers before using them. L3 Yes CWARN.IMPLICITINT MISRA.DECL.NO_TYPE MISRA.FUNC.NOPROT.CALL RETVOID.IMPLICIT
Rule 02 - Declarations and Initialization(DCL) DCL36-C Do not declare an identifier with conflicting linkage classifications. L2 Yes MISRA.FUNC.STATIC.REDECL
Rule 02 - Declarations and Initialization(DCL) DCL37-C Do not declare or define a reserved identifier. L3 Yes MISRA.DEFINE.WRONGNAME.UNDERSCORE MISRA.STDLIB.WRONGNAME MISRA.STDLIB.WRONGNAME.UNDERSCORE
Rule 02 - Declarations and Initialization(DCL) DCL38-C Use the correct syntax when declaring a flexible array member. L3 Yes CERT.STRUCT.FLEXIBLE_ARRAY_MEMBER
Rule 02 - Declarations and Initialization(DCL) DCL39-C Avoid information leakage when passing a structure across a trust boundary. L3 Yes PORTING.STORAGE.STRUCT
Rule 02 - Declarations and Initialization(DCL) DCL40-C Do not create incompatible declarations of the same function or object. L3 Yes MISRA.FUNC.NOPROT.DEF.2012 MISRA.FUNC.PARAMS.IDENT
Rule 02 - Declarations and Initialization(DCL) DCL41-C Do not declare variables inside a switch statement before the first case label. L3 Yes CERT.DCL.SWITCH.VAR_BEFORE_CASE
Rule 03 - Expressions (EXP) EXP30-C Do not depend on the order of evaluation for side effects. L2 Yes MISRA.INCR_DECR.OTHER PORTING.VAR.EFFECTS
Rule 03 - Expressions (EXP) EXP32-C Do not access a volatile object through a nonvolatile reference. L2 Yes CERT.EXPR.VOLATILE.ADDR CERT.EXPR.VOLATILE.ADDR.PARAM CERT.EXPR.VOLATILE.PTRPTR
Rule 03 - Expressions (EXP) EXP33-C Do not read uninitialized memory. L1 Yes UNINIT.HEAP.MIGHT UNINIT.HEAP.MUST UNINIT.STACK.ARRAY.MIGHT UNINIT.STACK.ARRAY.MUST UNINIT.STACK.ARRAY.PARTIAL.MUST UNINIT.STACK.MIGHT UNINIT.STACK.MUST
Rule 03 - Expressions (EXP) EXP34-C Do not dereference null pointers. L1 Yes NPD.CHECK.CALL.MIGHT NPD.CHECK.CALL.MUST NPD.CHECK.MIGHT NPD.CHECK.MUST NPD.CONST.CALL NPD.CONST.DEREF NPD.FUNC.CALL.MIGHT NPD.FUNC.CALL.MUST NPD.FUNC.MIGHT NPD.FUNC.MUST NPD.GEN.CALL.MIGHT NPD.GEN.CALL.MUST NPD.GEN.MIGHT NPD.GEN.MUST RNPD.CALL RNPD.DEREF
Rule 03 - Expressions (EXP) EXP35-C Do not modify objects with temporary lifetime. L3 No
Rule 03 - Expressions (EXP) EXP36-C Do not cast pointers into more strictly aligned pointer types. L3 Yes MISRA.CAST.OBJ_PTR_TO_OBJ_PTR.2012
Rule 03 - Expressions (EXP) EXP37-C Call functions with the correct number and type of arguments. L3 Yes MISRA.FUNC.UNMATCHED.PARAMS
Rule 03 - Expressions (EXP) EXP39-C Do not access a variable through a pointer of an incompatible type. L3 Yes MISRA.CAST.FUNC_PTR.2012 MISRA.CAST.INCOMPLETE_PTR_TO_ANY.2012 MISRA.CAST.OBJ_PTR_TO_NON_INT.2012 MISRA.CAST.OBJ_PTR_TO_OBJ_PTR.2012
Rule 03 - Expressions (EXP) EXP40-C Do not modify constant objects. L3 No
Rule 03 - Expressions (EXP) EXP42-C Do not compare padding data. L2 Yes MISRA.STDLIB.MEMCMP.PTR_ARG_TYPES
Rule 03 - Expressions (EXP) EXP43-C Avoid undefined behavior when using restrict-qualified pointers. L3 Yes MISRA.TYPE.RESTRICT.QUAL.2012
Rule 03 - Expressions (EXP) EXP44-C Do not rely on side effects in operands to sizeof, _Alignof, or _Generic. L3 Yes MISRA.SIZEOF.SIDE_EFFECT
Rule 03 - Expressions (EXP) EXP45-C Do not perform assignments in selection statements. L2 Yes ASSIGCOND.CALL ASSIGCOND.GEN MISRA.ASSIGN.COND
Rule 03 - Expressions (EXP) EXP46-C Do not use a bitwise operator with a Boolean-like operand. L2 Yes MISRA.LOGIC.OPERATOR.NOT_BOOL
Rule 03 - Expressions (EXP) EXP47-C Do not call va_arg with an argument of the incorrect type. L2 Yes CERT.VA_ARG.TYPE
Rule 04 - Integers (INT) INT30-C Ensure that unsigned integer operations do not wrap. L2 Yes CWARN.NOEFFECT.OUTOFRANGE NUM.OVERFLOW NUM.OVERFLOW.DF
Rule 04 - Integers (INT) INT31-C Ensure that integer conversions do not result in lost or misinterpreted data. L2 Yes PORTING.CAST.SIZE
Rule 04 - Integers (INT) INT32-C Ensure that operations on signed integers do not result in overflow. L2 Yes CWARN.NOEFFECT.OUTOFRANGE NUM.OVERFLOW NUM.OVERFLOW.DF
Rule 04 - Integers (INT) INT33-C Ensure that division and remainder operations do not result in divide-by-zero errors. L2 Yes DBZ.CONST DBZ.CONST.CALL DBZ.GENERAL DBZ.GENERAL.FLOAT DBZ.ITERATOR DBZ.ITERATOR.CALL DBZ.ITERATOR.FLOAT
Rule 04 - Integers (INT) INT34-C 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. L3 Yes MISRA.SHIFT.RANGE.2012
Rule 04 - Integers (INT) INT35-C Use correct integer precisions. L3 No
Rule 04 - Integers (INT) INT36-C Converting a pointer to integer or integer to pointer. L3 Yes MISRA.CAST.OBJ_PTR_TO_INT.2012
Rule 05 - Floating Point (FLP) FLP30-C Do not use floating-point variables as loop counters. L2 Yes MISRA.FOR.COUNTER.FLT
Rule 05 - Floating Point (FLP) FLP32-C Prevent or detect domain and range errors in math functions. L2 Yes CERT.MATH.DOMAIN.CHECK CERT.MATH.RANGE.CHECK
Rule 05 - Floating Point (FLP) FLP34-C Ensure that floating-point conversions are within range of the new type. L3 Yes MISRA.CAST.FLOAT.WIDER MISRA.CAST.FLOAT_INT MISRA.CAST.INT_FLOAT MISRA.CONV.FLOAT
Rule 05 - Floating Point (FLP) FLP36-C Preserve precision when converting integral values to floating-point type. L3 Yes PORTING.CAST.FLTPNT
Rule 05 - Floating Point (FLP) FLP37-C Do not use object representations to compare floating-point values. L3 Yes CERT.MEMCMP.FLOAT_MEMBER MISRA.STDLIB.MEMCMP.PTR_ARG_TYPES
Rule 06 - Arrays (ARR) ARR30-C Do not form or use out-of-bounds pointers or array subscripts. L2 Yes ABV.ANY_SIZE_ARRAY ABV.GENERAL ABV.GENERAL.MULTIDIMENSION ABV.NON_ARRAY ABV.STACK ABV.TAINTED ABV.UNICODE.BOUND_MAP ABV.UNICODE.FAILED_MAP ABV.UNICODE.NNTS_MAP ABV.UNICODE.SELF_MAP ABV.UNKNOWN_SIZE NNTS.MIGHT NNTS.MUST NNTS.TAINTED NPD.FUNC.CALL.MIGHT SV.TAINTED.INDEX_ACCESS SV.TAINTED.LOOP_BOUND
Rule 06 - Arrays (ARR) ARR32-C Ensure size arguments for variable length arrays are in a valid range. L2 Yes MISRA.ARRAY.VAR_LENGTH.2012
Rule 06 - Arrays (ARR) ARR36-C Do not subtract or compare two pointers that do not refer to the same array. L2 Yes MISRA.PTR.ARITH
Rule 06 - Arrays (ARR) ARR37-C Do not add or subtract an integer to a pointer to a non-array object. L2 Yes CERT.ARR.PTR.ARITH
Rule 06 - Arrays (ARR) ARR38-C Guarantee that library functions do not form invalid pointers. L1 Yes ABV.GENERAL ABV.GENERAL.MULTIDIMENSION
Rule 06 - Arrays (ARR) ARR39-C Do not add or subtract a scaled integer to a pointer. L2 Yes CERT.ARR.PTR.ARITH
Rule 07 - Characters and String (STR) STR30-C Do not attempt to modify string literals. L2 Yes CERT.STR.ARG.CONST_TO_NONCONST CERT.STR.ASSIGN.CONST_TO_NONCONST
Rule 07 - Characters and String (STR) STR31-C Guarantee that storage for strings has sufficient space for character data and the null terminator. L1 Yes SV.FMT_STR.BAD_SCAN_FORMAT SV.UNBOUND_STRING_INPUT.FUNC
Rule 07 - Characters and String (STR) STR32-C Do not pass a non-null-terminated character sequence to a library function that expects a string. L1 Yes NNTS.MIGHT NNTS.MUST SV.STRBO.BOUND_COPY.UNTERM
Rule 07 - Characters and String (STR) STR34-C Cast characters to unsigned char before converting to larger integer sizes. L2 Yes CXX.CAST.SIGNED_CHAR_TO_INTEGER
Rule 07 - Characters and String (STR) STR37-C Arguments to character-handling functions must be representable as an unsigned char. L3 Yes AUTOSAR.STDLIB.CCTYPE.UCHAR MISRA.ETYPE.ASSIGN.2012
Rule 07 - Characters and String (STR) STR38-C Do not confuse narrow and wide character strings and functions. L1 Yes CXX.DIFF.WIDTH.STR_AND_FUNC
Rule 08 - Memory Management (MEM) MEM30-C Do not access freed memory. L1 Yes UFM.DEREF.MIGHT UFM.DEREF.MUST UFM.FFM.MIGHT UFM.FFM.MUST UFM.RETURN.MIGHT UFM.RETURN.MUST UFM.USE.MIGHT UFM.USE.MUST
Rule 08 - Memory Management (MEM) MEM31-C Free dynamically allocated memory when no longer needed. L2 Yes CL.FFM.ASSIGN CL.FFM.COPY CL.SHALLOW.ASSIGN CL.SHALLOW.COPY FMM.MIGHT FMM.MUST
Rule 08 - Memory Management (MEM) MEM33-C Allocate and copy structures containing a flexible array member dynamically. L3 Yes MISRA.INCOMPLETE.STRUCT MISRA.MEMB.FLEX_ARRAY.2012
Rule 08 - Memory Management (MEM) MEM34-C Only free memory allocated dynamically. L1 Yes FNH.MIGHT FNH.MUST
Rule 08 - Memory Management (MEM) MEM35-C Allocate sufficient memory for an object. L2 Yes INCORRECT.ALLOC_SIZE SV.TAINTED.ALLOC_SIZE
Rule 08 - Memory Management (MEM) MEM36-C Do not modify the alignment of objects by calling realloc(). L3 Yes AUTOSAR.STDLIB.MEMORY
Rule 09 - Input Output (FIO) FIO30-C Exclude user input from format strings. L1 Yes SV.FMTSTR.GENERIC SV.TAINTED.FMTSTR
Rule 09 - Input Output (FIO) FIO32-C Do not perform operations on devices that are only appropriate for files. L3 No
Rule 09 - Input Output (FIO) FIO34-C Distinguish between characters read from a file and EOF or WEOF. L1 Yes CWARN.CMPCHR.EOF
Rule 09 - Input Output (FIO) FIO37-C Do not assume that fgets() or fgetws() returns a nonempty string when successful. L1 Yes CERT.FIO.FGETS
Rule 09 - Input Output (FIO) FIO38-C Do not copy a FILE object. L3 Yes MISRA.FILE_PTR.DEREF.2012 MISRA.FILE_PTR.DEREF.CAST.2012 MISRA.FILE_PTR.DEREF.INDIRECT.2012 MISRA.FILE_PTR.DEREF.RETURN.2012
Rule 09 - Input Output (FIO) FIO39-C Do not alternately input and output from a stream without an intervening flush or positioning call. L2 Yes CERT.FIO.NO_FLUSH
Rule 09 - Input Output (FIO) FIO40-C Reset strings on fgets() or fgetws() failure. L3 No
Rule 09 - Input Output (FIO) FIO41-C Do not call getc(), putc(), getwc(), or putwc() with a stream argument that has side effects. L3 No
Rule 09 - Input Output (FIO) FIO42-C Close files when they are no longer needed. L3 Yes RH.LEAK
Rule 09 - Input Output (FIO) FIO44-C Only use values for fsetpos() that are returned from fgetpos(). L3 Yes CERT.FSETPOS.VALUE
Rule 09 - Input Output (FIO) FIO45-C Avoid TOCTOU race conditions while accessing files. L2 Yes SV.TOCTOU.FILE_ACCESS
Rule 09 - Input Output (FIO) FIO46-C Do not access a closed file. L3 Yes SV.INCORRECT_RESOURCE_HANDLING.URH
Rule 09 - Input Output (FIO) FIO47-C Use valid format strings. L2 Yes SV.FMT_STR.PRINT_FORMAT_MISMATCH.BAD SV.FMT_STR.PRINT_FORMAT_MISMATCH.UNDESIRED SV.FMT_STR.PRINT_IMPROP_LENGTH SV.FMT_STR.PRINT_PARAMS_WRONGNUM.FEW SV.FMT_STR.PRINT_PARAMS_WRONGNUM.MANY SV.FMT_STR.SCAN_FORMAT_MISMATCH.BAD SV.FMT_STR.SCAN_FORMAT_MISMATCH.UNDESIRED SV.FMT_STR.SCAN_IMPROP_LENGTH SV.FMT_STR.SCAN_PARAMS_WRONGNUM.FEW SV.FMT_STR.SCAN_PARAMS_WRONGNUM.MANY SV.FMT_STR.UNKWN_FORMAT
Rule 10 - Environment (ENV) ENV30-C Do not modify the object referenced by the return value of certain functions. L3 Yes MISRA.STDLIB.CTYPE.RANGE.2012_AMD1 MISRA.STDLIB.ILLEGAL_REUSE.2012_AMD1 MISRA.STDLIB.ILLEGAL_WRITE.2012_AMD1
Rule 10 - Environment (ENV) ENV31-C Do not rely on an environment pointer following an operation that may invalidate it. L3 No
Rule 10 - Environment (ENV) ENV32-C All exit handlers must return normally. L1 Yes CERT.EXIT.HANDLER_TERMINATE
Rule 10 - Environment (ENV) ENV33-C Do not call system(). L1 Yes SV.CODE_INJECTION.SHELL_EXEC
Rule 10 - Environment (ENV) ENV34-C Do not store pointers returned by certain functions. L3 Yes MISRA.STDLIB.ILLEGAL_REUSE.2012_AMD1
Rule 11 - Signals (SIG) SIG30-C Call only asynchronous-safe functions within signal handlers. L1 Yes CERT.SIG.SIG_HANDLER.ASYNC_SAFE
Rule 11 - Signals (SIG) SIG31-C Do not access shared objects in signal handlers. L2 Yes CERT.SIG.SIG_HANDLER.SHARED_OBJ CERT.SIG.SIG_HANDLER.SHARED_OBJ.HEAP CERT.SIG.SIG_HANDLER.SHARED_OBJ.MIGHT
Rule 11 - Signals (SIG) SIG34-C Do not call signal() from within interruptible signal handlers. L3 Yes MISRA.STDLIB.SIGNAL
Rule 11 - Signals (SIG) SIG35-C Do not return from a computational exception signal handler. L3 Yes CERT.STDLIB.SIGNAL
Rule 12 - Error Handling (ERR) ERR30-C 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. L2 Yes CXX.ERRNO.INCORRECTLY_CHECKED CXX.ERRNO.NOT_CHECKED CXX.ERRNO.NOT_SET
Rule 12 - Error Handling (ERR) ERR32-C Do not rely on indeterminate values of errno. L3 Yes MISRA.INCL.SIGNAL.2012 MISRA.STDLIB.SIGNAL
Rule 12 - Error Handling (ERR) ERR33-C Detect and handle standard library errors. L1 Yes NPD.CHECK.MUST NPD.FUNC.MUST SV.RVT.RETVAL_NOTTESTED
Rule 12 - Error Handling (ERR) ERR34-C Detect errors when converting a string to a number. L3 Yes CERT.ERR.CONV.STR_TO_NUM MISRA.STDLIB.ATOI SV.BANNED.RECOMMENDED.SCANF
Rule 14 - Concurrency (CON) CON30-C Clean up thread-specific storage. L3 No
Rule 14 - Concurrency (CON) CON31-C Do not destroy a mutex while it is locked. L3 No
Rule 14 - Concurrency (CON) CON32-C Prevent data races when accessing bit-fields from multiple threads. L2 No
Rule 14 - Concurrency (CON) CON33-C Avoid race conditions when using library functions. L3 Yes CERT.CONC.LIB_FUNC_USE
Rule 14 - Concurrency (CON) CON34-C Declare objects shared between threads with appropriate storage durations. L3 No
Rule 14 - Concurrency (CON) CON35-C Avoid deadlock by locking in a predefined order. L3 Yes CONC.DL CONC.NO_UNLOCK
Rule 14 - Concurrency (CON) CON36-C Wrap functions that can spuriously wake up in a loop. L3 Yes CERT.CONC.WAKE_IN_LOOP_C
Rule 14 - Concurrency (CON) CON37-C Do not call signal() in a multithreaded program. L2 Yes MISRA.STDLIB.SIGNAL
Rule 14 - Concurrency (CON) CON38-C Preserve thread safety and liveness when using condition variables. L3 Yes CERT.CONC.UNSAFE_COND_VAR_C
Rule 14 - Concurrency (CON) CON39-C Do not join or detach a thread that was previously joined or detached. L2 No
Rule 14 - Concurrency (CON) CON40-C Do not refer to an atomic variable twice in an expression. L2 Yes CERT.CONC.ATOMIC_TWICE_EXPR
Rule 14 - Concurrency (CON) CON41-C Wrap functions that can fail spuriously in a loop. L3 Yes CERT.CONC.ATOMIC_COMP_FAIL_IN_LOOP
Rule 14 - Concurrency (CON) CON43-C Do not allow data races in multithreaded code. L3 No
Rule 48 - Miscellaneous (MISC) MSC30-C Do not use the rand() function for generating pseudorandom numbers. L2 Yes CERT.MSC.STD_RAND_CALL
Rule 48 - Miscellaneous (MISC) MSC32-C Properly seed pseudorandom number generators. L1 Yes CERT.MSC.SEED_RANDOM
Rule 48 - Miscellaneous (MISC) MSC33-C Do not pass invalid data to the asctime() function. L1 Yes CERT.MSC.ASCTIME
Rule 48 - Miscellaneous (MISC) MSC37-C Ensure that control never reaches the end of a non-void function. L2 Yes FUNCRET.GEN FUNCRET.IMPLICIT
Rule 48 - Miscellaneous (MISC) MSC38-C Do not treat a predefined identifier as an object if it might only be implemented as a macro. L3 No
Rule 48 - Miscellaneous (MISC) MSC39-C Do not call va_arg() on a va_list that has an indeterminate value. L3 Yes VA.LIST.INDETERMINATE
Rule 48 - Miscellaneous (MISC) MSC40-C Do not violate constraints. L3 Yes MISRA.FUNC.STATIC.REDECL
Rule 48 - Miscellaneous (MISC) MSC41-C Never hard code sensitive information. L1 Yes CXX.SV.PWD.PLAIN CXX.SV.PWD.PLAIN.LENGTH CXX.SV.PWD.PLAIN.LENGTH.ZERO HCC HCC.PWD HCC.USER