Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler.
Number of rules (primarily dangerous function names) in C/C++ ruleset: 223
Examining data/cmocka-1.1.5/coverity/coverity_internal_model.c
Examining data/cmocka-1.1.5/coverity/coverity_assert_model.c
Examining data/cmocka-1.1.5/example/allocate_module.c
Examining data/cmocka-1.1.5/example/assert_macro.c
Examining data/cmocka-1.1.5/example/assert_macro.h
Examining data/cmocka-1.1.5/example/assert_macro_test.c
Examining data/cmocka-1.1.5/example/assert_module.c
Examining data/cmocka-1.1.5/example/assert_module.h
Examining data/cmocka-1.1.5/example/assert_module_test.c
Examining data/cmocka-1.1.5/example/calculator.c
Examining data/cmocka-1.1.5/example/calculator_test.c
Examining data/cmocka-1.1.5/example/database.h
Examining data/cmocka-1.1.5/example/allocate_module_test.c
Examining data/cmocka-1.1.5/example/mock/chef_wrap/chef.c
Examining data/cmocka-1.1.5/example/mock/chef_wrap/chef.h
Examining data/cmocka-1.1.5/example/mock/chef_wrap/waiter_test_wrap.c
Examining data/cmocka-1.1.5/example/mock/chef_wrap/waiter_test_wrap.h
Examining data/cmocka-1.1.5/example/mock/uptime/proc_uptime.c
Examining data/cmocka-1.1.5/example/mock/uptime/proc_uptime.h
Examining data/cmocka-1.1.5/example/mock/uptime/uptime.c
Examining data/cmocka-1.1.5/example/mock/uptime/test_uptime.c
Examining data/cmocka-1.1.5/example/simple_test.c
Examining data/cmocka-1.1.5/include/cmockery/cmockery.h
Examining data/cmocka-1.1.5/include/cmockery/pbc.h
Examining data/cmocka-1.1.5/include/cmocka_pbc.h
Examining data/cmocka-1.1.5/include/cmocka_private.h
Examining data/cmocka-1.1.5/include/cmocka.h
Examining data/cmocka-1.1.5/src/cmocka.c
Examining data/cmocka-1.1.5/tests/test_alloc.c
Examining data/cmocka-1.1.5/tests/test_assert_macros.c
Examining data/cmocka-1.1.5/tests/test_assert_macros_fail.c
Examining data/cmocka-1.1.5/tests/test_basics.c
Examining data/cmocka-1.1.5/tests/test_cmockery.c
Examining data/cmocka-1.1.5/tests/test_fixtures.c
Examining data/cmocka-1.1.5/tests/test_group_fixtures.c
Examining data/cmocka-1.1.5/tests/test_group_setup_assert.c
Examining data/cmocka-1.1.5/tests/test_group_setup_fail.c
Examining data/cmocka-1.1.5/tests/test_groups.c
Examining data/cmocka-1.1.5/tests/test_ordering.c
Examining data/cmocka-1.1.5/tests/test_ordering_fail.c
Examining data/cmocka-1.1.5/tests/test_returns.c
Examining data/cmocka-1.1.5/tests/test_returns_fail.c
Examining data/cmocka-1.1.5/tests/test_setup_fail.c
Examining data/cmocka-1.1.5/tests/test_skip.c
Examining data/cmocka-1.1.5/tests/test_strmatch.c
Examining data/cmocka-1.1.5/tests/test_wildcard.c
Examining data/cmocka-1.1.5/tests/test_exception_handler.c
Examining data/cmocka-1.1.5/tests/test_float_macros.c
Examining data/cmocka-1.1.5/tests/test_skip_filter.c

FINAL RESULTS:

data/cmocka-1.1.5/example/calculator.c:35:8:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#ifdef printf
data/cmocka-1.1.5/example/calculator.c:36:8:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#undef printf
data/cmocka-1.1.5/example/calculator.c:39:9:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define printf example_test_printf
data/cmocka-1.1.5/example/calculator.c:45:8:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#ifdef fprintf
data/cmocka-1.1.5/example/calculator.c:46:8:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#undef fprintf
data/cmocka-1.1.5/example/calculator.c:48:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define fprintf example_test_fprintf
data/cmocka-1.1.5/example/calculator_test.c:24:9:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#define vsnprintf _vsnprintf
data/cmocka-1.1.5/example/calculator_test.c:69:17:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	return_value = vsnprintf(temporary_buffer, sizeof(temporary_buffer),
data/cmocka-1.1.5/example/calculator_test.c:82:17:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	return_value = vsnprintf(temporary_buffer, sizeof(temporary_buffer),
data/cmocka-1.1.5/include/cmocka_private.h:43:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#   undef snprintf
data/cmocka-1.1.5/include/cmocka_private.h:44:12:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#   define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
data/cmocka-1.1.5/include/cmocka_private.h:47:13:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#     undef snprintf
data/cmocka-1.1.5/include/cmocka_private.h:48:14:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#     define snprintf _snprintf
data/cmocka-1.1.5/include/cmocka_private.h:48:23:  [4] (format) _snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#     define snprintf _snprintf
data/cmocka-1.1.5/include/cmocka_private.h:57:11:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#   undef vsnprintf
data/cmocka-1.1.5/include/cmocka_private.h:58:12:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#   define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v))
data/cmocka-1.1.5/include/cmocka_private.h:61:12:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#    undef vsnprintf
data/cmocka-1.1.5/include/cmocka_private.h:62:13:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#    define vsnprintf _vsnprintf
data/cmocka-1.1.5/src/cmocka.c:1937:11:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    len = vsnprintf(buffer, sizeof(buffer), format, args);
data/cmocka-1.1.5/src/cmocka.c:1967:9:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
        vsnprintf(cm_error_message + msg_len, len, format, ap);
data/cmocka-1.1.5/src/cmocka.c:2265:5:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    vsnprintf(buffer, sizeof(buffer), format, args);
data/cmocka-1.1.5/src/cmocka.c:2276:5:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    vsnprintf(buffer, sizeof(buffer), format, args);
data/cmocka-1.1.5/src/cmocka.c:394:23:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    const char *env = getenv("CMOCKA_TEST_ABORT");
data/cmocka-1.1.5/src/cmocka.c:2306:11:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    env = getenv("CMOCKA_MESSAGE_OUTPUT");
data/cmocka-1.1.5/src/cmocka.c:2347:11:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    env = getenv("CMOCKA_XML_FILE");
data/cmocka-1.1.5/example/calculator_test.c:60:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char temporary_buffer[256];
data/cmocka-1.1.5/example/mock/uptime/proc_uptime.c:36:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buf[1024] = {0};
data/cmocka-1.1.5/example/mock/uptime/proc_uptime.c:45:10:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    fd = open(uptime_path, O_RDONLY);
data/cmocka-1.1.5/example/mock/uptime/uptime.c:32:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buf[1024] = {0};
data/cmocka-1.1.5/src/cmocka.c:472:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy(src + of, repl, rl);
data/cmocka-1.1.5/src/cmocka.c:1408:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(set, values, number_of_values * sizeof(values[0]));
data/cmocka-1.1.5/src/cmocka.c:1606:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(mem, memory, size);
data/cmocka-1.1.5/src/cmocka.c:1931:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buffer[1024];
data/cmocka-1.1.5/src/cmocka.c:1965:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy(cm_error_message + msg_len, buffer, len + 1);
data/cmocka-1.1.5/src/cmocka.c:2045:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char *guards[2] = {block - MALLOC_GUARD_SIZE,
data/cmocka-1.1.5/src/cmocka.c:2108:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(new_block, ptr, block_size);
data/cmocka-1.1.5/src/cmocka.c:2264:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buffer[1024];
data/cmocka-1.1.5/src/cmocka.c:2275:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buffer[1024];
data/cmocka-1.1.5/src/cmocka.c:2349:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char buf[1024];
data/cmocka-1.1.5/src/cmocka.c:2359:14:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        fp = fopen(buf, "r");
data/cmocka-1.1.5/src/cmocka.c:2361:18:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
            fp = fopen(buf, "w");
data/cmocka-1.1.5/src/cmocka.c:2371:22:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
                fp = fopen(buf, "a");
data/cmocka-1.1.5/src/cmocka.c:3075:17:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
                char err_msg[2048] = {0};
data/cmocka-1.1.5/tests/test_assert_macros_fail.c:29:10:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    fd = open("this_file_doesnt_exist.cmocka", 0);
data/cmocka-1.1.5/example/mock/uptime/proc_uptime.c:50:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    nread = read(fd, buf, sizeof(buf));
data/cmocka-1.1.5/include/cmocka_private.h:142:63:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
#define BURN_STRING(x) do { if ((x) != NULL) memset((x), 'X', strlen((x))); } while(0)
data/cmocka-1.1.5/src/cmocka.c:397:24:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    if (env != NULL && strlen(env) == 1) {
data/cmocka-1.1.5/src/cmocka.c:459:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        size_t l  = strlen(src);
data/cmocka-1.1.5/src/cmocka.c:460:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        size_t pl = strlen(pattern);
data/cmocka-1.1.5/src/cmocka.c:461:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        size_t rl = strlen(repl);
data/cmocka-1.1.5/src/cmocka.c:1164:10:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    if (!equal) {
data/cmocka-1.1.5/src/cmocka.c:1168:12:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    return equal;
data/cmocka-1.1.5/src/cmocka.c:1189:10:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    if (!equal) {
data/cmocka-1.1.5/src/cmocka.c:1193:12:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    return equal;
data/cmocka-1.1.5/src/cmocka.c:1955:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        msg_len = strlen(cm_error_message);
data/cmocka-1.1.5/tests/test_alloc.c:28:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    len = strlen(str);
data/cmocka-1.1.5/tests/test_alloc.c:50:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    len = strlen(str);
data/cmocka-1.1.5/tests/test_alloc.c:58:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    len = strlen(str);

ANALYSIS SUMMARY:

Hits = 58
Lines analyzed = 9358 in approximately 0.38 seconds (24329 lines/second)
Physical Source Lines of Code (SLOC) = 5664
Hits@level = [0]  35 [1]  14 [2]  19 [3]   3 [4]  22 [5]   0
Hits@level+ = [0+]  93 [1+]  58 [2+]  44 [3+]  25 [4+]  22 [5+]   0
Hits/KSLOC@level+ = [0+] 16.4195 [1+] 10.2401 [2+] 7.76836 [3+] 4.41384 [4+] 3.88418 [5+]   0
Dot directories skipped = 1 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.