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/python-dmidecode-3.12.2/src/compat.h
Examining data/python-dmidecode-3.12.2/src/dmidecode.h
Examining data/python-dmidecode-3.12.2/src/dmidecodemodule.h
Examining data/python-dmidecode-3.12.2/src/dmidump.c
Examining data/python-dmidecode-3.12.2/src/dmidump.h
Examining data/python-dmidecode-3.12.2/src/dmierror.c
Examining data/python-dmidecode-3.12.2/src/dmierror.h
Examining data/python-dmidecode-3.12.2/src/dmihelper.h
Examining data/python-dmidecode-3.12.2/src/dmilog.c
Examining data/python-dmidecode-3.12.2/src/dmilog.h
Examining data/python-dmidecode-3.12.2/src/dmioem.c
Examining data/python-dmidecode-3.12.2/src/dmioem.h
Examining data/python-dmidecode-3.12.2/src/dmixml.c
Examining data/python-dmidecode-3.12.2/src/dmixml.h
Examining data/python-dmidecode-3.12.2/src/efi.c
Examining data/python-dmidecode-3.12.2/src/efi.h
Examining data/python-dmidecode-3.12.2/src/libxml_wrap.h
Examining data/python-dmidecode-3.12.2/src/types.h
Examining data/python-dmidecode-3.12.2/src/util.c
Examining data/python-dmidecode-3.12.2/src/util.h
Examining data/python-dmidecode-3.12.2/src/version.h
Examining data/python-dmidecode-3.12.2/src/xmlpythonizer.c
Examining data/python-dmidecode-3.12.2/src/xmlpythonizer.h
Examining data/python-dmidecode-3.12.2/src/config.h
Examining data/python-dmidecode-3.12.2/src/dmidecodemodule.c
Examining data/python-dmidecode-3.12.2/src/dmidecode.c

FINAL RESULTS:

data/python-dmidecode-3.12.2/src/dmidecodemodule.c:225:12:  [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.
        if(access(f, R_OK) < 0) {
data/python-dmidecode-3.12.2/src/dmidecodemodule.c:621:14:  [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.
        if( (access(f, F_OK) != 0) || ((access(f, W_OK) == 0) && S_ISREG(_buf.st_mode)) ) {
data/python-dmidecode-3.12.2/src/dmidecodemodule.c:621:41:  [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.
        if( (access(f, F_OK) != 0) || ((access(f, W_OK) == 0) && S_ISREG(_buf.st_mode)) ) {
data/python-dmidecode-3.12.2/src/dmierror.c:61:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf(stderr, fmt, ap);
data/python-dmidecode-3.12.2/src/dmierror.c:73:9:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        vfprintf(stderr, buf, ap);
data/python-dmidecode-3.12.2/src/dmilog.c:78: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(logmsg, 4096, fmt, ap);
data/python-dmidecode-3.12.2/src/dmilog.c:147:4:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
			strcat(ret, ptr->message);
data/python-dmidecode-3.12.2/src/dmioem.c:94:17:  [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.
                printf(h->type == 221 ?
data/python-dmidecode-3.12.2/src/dmidecode.c:271:22:  [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 const char *unit[8] = {
data/python-dmidecode-3.12.2/src/dmidecode.c:1717:22:  [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 const char *location[4] = {
data/python-dmidecode-3.12.2/src/dmidecode.c:3336: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 timestr[5][5];
data/python-dmidecode-3.12.2/src/dmidump.c:59: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(dumpfile, add ? "r+b" : "wb");
data/python-dmidecode-3.12.2/src/dmidump.c:124:25:  [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(crafted, buf, 32);
data/python-dmidecode-3.12.2/src/dmidump.c:133:25:  [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(crafted, buf, 16);
data/python-dmidecode-3.12.2/src/dmilog.c:73: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 logmsg[4098];
data/python-dmidecode-3.12.2/src/efi.c:51: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 linebuf[64];
data/python-dmidecode-3.12.2/src/efi.c:60:26:  [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).
        if((efi_systab = fopen(filename = "/sys/firmware/efi/systab", "r")) == NULL
data/python-dmidecode-3.12.2/src/efi.c:61:29:  [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).
           && (efi_systab = fopen(filename = "/proc/efi/systab", "r")) == NULL) {
data/python-dmidecode-3.12.2/src/util.c:123:34:  [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).
        if(sigill_error || (fd = open(devmem, O_RDONLY)) == -1) {
data/python-dmidecode-3.12.2/src/util.c:155: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(p, (u8 *) mmp + mmoffset, len);
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:368:52:  [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).
                        fixedsize = (fsz != NULL ? atoi(fsz) : 0);
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:485: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 typeid_s[16];
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:650:43:  [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).
                value = PYNUMBER_FROMLONG(atoi(workstr));
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:660:42:  [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).
                value = PyBool_FromLong((atoi(workstr) == 1 ? 1:0));
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:904:87:  [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).
                                                                PyList_SetItem(value, atoi(idx)-1,
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:987:71:  [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).
                                                PyList_SetItem(value, atoi(idx)-1, dataset);
data/python-dmidecode-3.12.2/src/dmidecode.c:111:23:  [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).
                bp += strlen(bp);
data/python-dmidecode-3.12.2/src/dmidecode.c:120: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).
        len = strlen(bp);
data/python-dmidecode-3.12.2/src/dmidecode.c:226:42:  [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).
                        snprintf(tmp_s + strlen(tmp_s), (h->length * 2)-strlen(tmp_s),
data/python-dmidecode-3.12.2/src/dmidecode.c:226:73:  [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).
                        snprintf(tmp_s + strlen(tmp_s), (h->length * 2)-strlen(tmp_s),
data/python-dmidecode-3.12.2/src/dmidecodemodule.c:653:37:  [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( (f == NULL) || (strlen(f) < 0) ) {
data/python-dmidecode-3.12.2/src/dmilog.c:137: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).
				ret = realloc(ret, strlen(ptr->message)+len+3);
data/python-dmidecode-3.12.2/src/dmilog.c:139: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).
				ret = calloc(1, strlen(ptr->message)+2);
data/python-dmidecode-3.12.2/src/dmilog.c:148:4:  [1] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant character.
			strcat(ret, "\n");
data/python-dmidecode-3.12.2/src/dmilog.c:150:10:  [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(ret);
data/python-dmidecode-3.12.2/src/dmilog.c:185:56:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if( (ptr->level == level) && ((unread == 1) || (ptr->read > 0)) ) {
data/python-dmidecode-3.12.2/src/dmilog.h:44:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	unsigned int read;	/**< Number of times this log entry has been read */
data/python-dmidecode-3.12.2/src/dmixml.c:392:17:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                strncpy(buf, (char *)xpo->stringval, buflen-1);
data/python-dmidecode-3.12.2/src/dmixml.c:403:33:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                                strncpy(buf, str, buflen-1);
data/python-dmidecode-3.12.2/src/util.c:60:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                r = read(fd, buf + r2, count - r2);
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:620:29:  [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).
                cp_p = cp + strlen(cp) - 1;
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:723:17:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                strncpy(key, map_p->key, buflen-1);
data/python-dmidecode-3.12.2/src/xmlpythonizer.c:746:35:  [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 ((key != NULL) && (strlen(key) > 0) ? key : NULL) ;

ANALYSIS SUMMARY:

Hits = 43
Lines analyzed = 10015 in approximately 0.33 seconds (30447 lines/second)
Physical Source Lines of Code (SLOC) = 6946
Hits@level = [0]  48 [1]  17 [2]  18 [3]   0 [4]   8 [5]   0
Hits@level+ = [0+]  91 [1+]  43 [2+]  26 [3+]   8 [4+]   8 [5+]   0
Hits/KSLOC@level+ = [0+] 13.1011 [1+] 6.19061 [2+] 3.74316 [3+] 1.15174 [4+] 1.15174 [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.