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/mbpfan-2.2.1/src/daemon.c
Examining data/mbpfan-2.2.1/src/daemon.h
Examining data/mbpfan-2.2.1/src/global.h
Examining data/mbpfan-2.2.1/src/main.c
Examining data/mbpfan-2.2.1/src/main.h
Examining data/mbpfan-2.2.1/src/mbpfan.c
Examining data/mbpfan-2.2.1/src/mbpfan.h
Examining data/mbpfan-2.2.1/src/minunit.c
Examining data/mbpfan-2.2.1/src/minunit.h
Examining data/mbpfan-2.2.1/src/settings.c
Examining data/mbpfan-2.2.1/src/settings.h
Examining data/mbpfan-2.2.1/src/strmap.c
Examining data/mbpfan-2.2.1/src/strmap.h
Examining data/mbpfan-2.2.1/src/util.c
Examining data/mbpfan-2.2.1/src/util.h

FINAL RESULTS:

data/mbpfan-2.2.1/src/mbpfan.c:81: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.
    cnt = vsnprintf(NULL, 0, fmt, ap);
data/mbpfan-2.2.1/src/mbpfan.c:90: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(buf, cnt + 1, fmt, ap);
data/mbpfan-2.2.1/src/mbpfan.c:114:23:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
            int res = access(path, R_OK);
data/mbpfan-2.2.1/src/mbpfan.c:164:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
		int res = access(hwmon_path, R_OK);
data/mbpfan-2.2.1/src/mbpfan.h:43:61:  [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.
char *smprintf(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
data/mbpfan-2.2.1/src/settings.c:191:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(buf, "[%s]\n", section->name);
data/mbpfan-2.2.1/src/settings.c:312:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(s->name, section);
data/mbpfan-2.2.1/src/settings.c:420:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(parse_state->current_section, buf);
data/mbpfan-2.2.1/src/settings.c:892:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(buf, "%s%c%s\n", key, KEY_VALUE_SEPARATOR_CHAR, value);
data/mbpfan-2.2.1/src/strmap.c:151:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(out_buf, pair->value);
data/mbpfan-2.2.1/src/strmap.c:223:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(pair->value, value);
data/mbpfan-2.2.1/src/strmap.c:277:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(pair->key, key);
data/mbpfan-2.2.1/src/strmap.c:278:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(pair->value, value);
data/mbpfan-2.2.1/src/util.c:18:5:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vprintf(fmt, args);
data/mbpfan-2.2.1/src/util.h:4:71:  [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.
void mbp_log(int level, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
data/mbpfan-2.2.1/src/main.c:103:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while( (c = getopt(argc, argv, "hftv|help")) != -1) {
data/mbpfan-2.2.1/src/minunit.c:102:13:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            srand ( time_seed() );
data/mbpfan-2.2.1/src/daemon.c:41:12:  [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).
    file = fopen(PROGRAM_PID, "w");
data/mbpfan-2.2.1/src/daemon.c:57:12:  [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).
    file = fopen(PROGRAM_PID, "r");
data/mbpfan-2.2.1/src/mbpfan.c:103:9:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
    if (atoi(str_kernel_version) < 3){
data/mbpfan-2.2.1/src/mbpfan.c:185:16:  [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).
		FILE *file = fopen(path, "r");
data/mbpfan-2.2.1/src/mbpfan.c:235: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).
    FILE *file = fopen(path, "r");
data/mbpfan-2.2.1/src/mbpfan.c:245: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).
    FILE *file = fopen(path, "r");
data/mbpfan-2.2.1/src/mbpfan.c:290: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).
        FILE *file = fopen(path_output, "w");
data/mbpfan-2.2.1/src/mbpfan.c:365:16:  [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).
        file = fopen(tmp->fan_manual_path, "rw+");
data/mbpfan-2.2.1/src/mbpfan.c:394:13:  [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[16];
data/mbpfan-2.2.1/src/mbpfan.c:410: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.
       char buf[16];
data/mbpfan-2.2.1/src/mbpfan.c:451:13:  [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).
        f = fopen("/etc/mbpfan.conf", "r");
data/mbpfan-2.2.1/src/mbpfan.c:454:13:  [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).
        f = fopen(settings_path, "r");
data/mbpfan-2.2.1/src/minunit.c:129:9:  [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).
    f = fopen("/etc/mbpfan.conf", "r");
data/mbpfan-2.2.1/src/settings.c:141: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[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:142: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 trimmed_buf[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:143: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 section_buf[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:176: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[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:378: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(out_buf, s0, len);
data/mbpfan-2.2.1/src/settings.c:395: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[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:396: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 buf1[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:397: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 buf2[MAX_LINECHARS];
data/mbpfan-2.2.1/src/settings.c:766: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 value[MAX_VALUECHARS];
data/mbpfan-2.2.1/src/settings.c:774:25:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        *((int *)out) = atoi(value);
data/mbpfan-2.2.1/src/settings.c:778:26:  [2] (integer) atol:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        *((long *)out) = atol(value);
data/mbpfan-2.2.1/src/settings.c:800:12:  [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 value[MAX_VALUECHARS];
data/mbpfan-2.2.1/src/settings.c:824:35:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
            ((int *)out)[count] = atoi(token);
data/mbpfan-2.2.1/src/settings.c:828:36:  [2] (integer) atol:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
            ((long *)out)[count] = atol(token);
data/mbpfan-2.2.1/src/settings.c:879: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[MAX_LINECHARS];
data/mbpfan-2.2.1/src/daemon.c:185:9:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
        umask(0022);
data/mbpfan-2.2.1/src/mbpfan.c:254:22:  [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).
    for (ssize_t i = strlen(str) - 1; i >= 0; --i) {
data/mbpfan-2.2.1/src/settings.c:279:9:  [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 (strlen(section) == 0) {
data/mbpfan-2.2.1/src/settings.c:304:34:  [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).
        s->name = (char*)malloc((strlen(section) + 1) * sizeof(char));
data/mbpfan-2.2.1/src/settings.c:416:13:  [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 (strlen(buf) + 1 > parse_state->current_section_n) {
data/mbpfan-2.2.1/src/settings.c:891:9:  [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 (strlen(key) < MAX_KEYCHARS && strlen(value) < MAX_VALUECHARS) {
data/mbpfan-2.2.1/src/settings.c:891:39:  [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 (strlen(key) < MAX_KEYCHARS && strlen(value) < MAX_VALUECHARS) {
data/mbpfan-2.2.1/src/strmap.c:140:16:  [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).
        return strlen(pair->value) + 1;
data/mbpfan-2.2.1/src/strmap.c:147:9:  [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 (strlen(pair->value) >= n_out_buf) {
data/mbpfan-2.2.1/src/strmap.c:196:15:  [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).
    key_len = strlen(key);
data/mbpfan-2.2.1/src/strmap.c:197:17:  [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).
    value_len = strlen(value);
data/mbpfan-2.2.1/src/strmap.c:209:13:  [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 (strlen(pair->value) < value_len) {

ANALYSIS SUMMARY:

Hits = 57
Lines analyzed = 4022 in approximately 0.11 seconds (35060 lines/second)
Physical Source Lines of Code (SLOC) = 1879
Hits@level = [0]  25 [1]  12 [2]  28 [3]   2 [4]  15 [5]   0
Hits@level+ = [0+]  82 [1+]  57 [2+]  45 [3+]  17 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 43.6402 [1+] 30.3353 [2+] 23.9489 [3+] 9.04737 [4+] 7.98297 [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.