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/pxe-kexec-0.2.4/ext/libbw/bwerror.h
Examining data/pxe-kexec-0.2.4/ext/libbw/completion.cc
Examining data/pxe-kexec-0.2.4/ext/libbw/completion.h
Examining data/pxe-kexec-0.2.4/ext/libbw/debug.cc
Examining data/pxe-kexec-0.2.4/ext/libbw/debug.h
Examining data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt.c
Examining data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt.h
Examining data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt_long.c
Examining data/pxe-kexec-0.2.4/ext/libbw/optionparser.cc
Examining data/pxe-kexec-0.2.4/ext/libbw/optionparser.h
Examining data/pxe-kexec-0.2.4/ext/libbw/serialfile.h
Examining data/pxe-kexec-0.2.4/ext/libbw/serialfile_posix.cc
Examining data/pxe-kexec-0.2.4/ext/libbw/stringutil.cc
Examining data/pxe-kexec-0.2.4/ext/libbw/stringutil.h
Examining data/pxe-kexec-0.2.4/src/console.cc
Examining data/pxe-kexec-0.2.4/src/console.h
Examining data/pxe-kexec-0.2.4/src/downloader.cc
Examining data/pxe-kexec-0.2.4/src/downloader.h
Examining data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c
Examining data/pxe-kexec-0.2.4/src/ext/rpmvercmp.h
Examining data/pxe-kexec-0.2.4/src/global.h
Examining data/pxe-kexec-0.2.4/src/kexec.cc
Examining data/pxe-kexec-0.2.4/src/kexec.h
Examining data/pxe-kexec-0.2.4/src/linuxdb.cc
Examining data/pxe-kexec-0.2.4/src/linuxdb.h
Examining data/pxe-kexec-0.2.4/src/main.cc
Examining data/pxe-kexec-0.2.4/src/networkhelper.h
Examining data/pxe-kexec-0.2.4/src/process.cc
Examining data/pxe-kexec-0.2.4/src/process.h
Examining data/pxe-kexec-0.2.4/src/pxekexec.cc
Examining data/pxe-kexec-0.2.4/src/pxekexec.h
Examining data/pxe-kexec-0.2.4/src/pxeparser.cc
Examining data/pxe-kexec-0.2.4/src/pxeparser.h
Examining data/pxe-kexec-0.2.4/src/networkhelper.cc

FINAL RESULTS:

data/pxe-kexec-0.2.4/ext/libbw/debug.cc:164:5:  [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(newmsg, msg);
data/pxe-kexec-0.2.4/ext/libbw/debug.cc:173:5:  [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(m_handle, newmsg, args);
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:29: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(str1, a);
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:30: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(str2, b);
data/pxe-kexec-0.2.4/src/process.cc:71: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.
        if (access(binary.c_str(), X_OK)) {
data/pxe-kexec-0.2.4/src/process.cc:127:13:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
            execvp(m_name.c_str(), vector);
data/pxe-kexec-0.2.4/src/pxekexec.cc:285: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(names[0], pxe_mac.c_str());
data/pxe-kexec-0.2.4/src/pxekexec.cc:287: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(names[i], pxe_ip.substr(0, 8-(i-1)).c_str());
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt.c:50:14:  [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.
__weak_alias(getopt,_getopt);
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt.c:88:1:  [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.
getopt(nargc, nargv, ostr)
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt.h:27:5:  [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.
int getopt(int, char**, char*);
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt.h:28:5:  [3] (buffer) getopt_long:
  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.
int getopt_long(int, char**, const char*, struct option*, int*);
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt_long.c:164:1:  [3] (buffer) getopt_long:
  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.
getopt_long(nargc, nargv, options, long_options, index)
data/pxe-kexec-0.2.4/ext/libbw/optionparser.cc:249:13:  [3] (buffer) getopt_long:
  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.
        c = getopt_long(argc, argv, getopt_string.c_str(),
data/pxe-kexec-0.2.4/src/process.cc:57:24:  [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 *path = getenv("PATH");
data/pxe-kexec-0.2.4/src/pxekexec.cc:497:31:  [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.
    std::string tmpdir = std::getenv("TMPDIR") ? std::getenv("TMPDIR") : "/tmp";
data/pxe-kexec-0.2.4/src/pxekexec.cc:497:55:  [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.
    std::string tmpdir = std::getenv("TMPDIR") ? std::getenv("TMPDIR") : "/tmp";
data/pxe-kexec-0.2.4/ext/libbw/debug.cc:150:13:  [2] (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 string.
            strcat(newmsg, "TRACE: ");
data/pxe-kexec-0.2.4/ext/libbw/debug.cc:154:13:  [2] (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 string.
            strcat(newmsg, "INFO: ");
data/pxe-kexec-0.2.4/ext/libbw/debug.cc:158:13:  [2] (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 string.
            strcat(newmsg, "DEBUG: ");
data/pxe-kexec-0.2.4/ext/libbw/optionparser.cc:269: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).
                v.setInteger(std::atoi(optarg));
data/pxe-kexec-0.2.4/ext/libbw/serialfile_posix.cc:138:13:  [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).
    d->fd = open(d->fileName.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
data/pxe-kexec-0.2.4/ext/libbw/serialfile_posix.cc:201: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[BUFSIZ];
data/pxe-kexec-0.2.4/src/console.cc:65:14:  [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(terminals[i], O_RDWR);
data/pxe-kexec-0.2.4/src/console.cc:67:18:  [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(terminals[i], O_WRONLY);
data/pxe-kexec-0.2.4/src/console.cc:69:18:  [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(terminals[i], O_RDONLY);
data/pxe-kexec-0.2.4/src/downloader.h:271: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              m_curl_errorstring[CURL_ERROR_SIZE];
data/pxe-kexec-0.2.4/src/networkhelper.cc:83: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[32];
data/pxe-kexec-0.2.4/src/networkhelper.cc:110: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[32];
data/pxe-kexec-0.2.4/src/networkhelper.h:224: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 m_mac[6];
data/pxe-kexec-0.2.4/src/pxekexec.cc:283: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 names[10][25];
data/pxe-kexec-0.2.4/src/pxekexec.cc:288:5:  [2] (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). Risk is low because the source is a constant string.
    strcpy(names[9], "default");
data/pxe-kexec-0.2.4/ext/libbw/completion.cc:229:41:  [1] (buffer) mismatch:
  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.
        for (unsigned int mismatch = 0; mismatch < len; ++mismatch) {
data/pxe-kexec-0.2.4/ext/libbw/completion.cc:229:59:  [1] (buffer) mismatch:
  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.
        for (unsigned int mismatch = 0; mismatch < len; ++mismatch) {
data/pxe-kexec-0.2.4/ext/libbw/completion.cc:230:23:  [1] (buffer) mismatch:
  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 ((*it)[mismatch] != replacement[mismatch]) {
data/pxe-kexec-0.2.4/ext/libbw/completion.cc:230:48:  [1] (buffer) mismatch:
  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 ((*it)[mismatch] != replacement[mismatch]) {
data/pxe-kexec-0.2.4/ext/libbw/completion.cc:231:53:  [1] (buffer) mismatch:
  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.
                replacement = replacement.substr(0, mismatch);
data/pxe-kexec-0.2.4/ext/libbw/debug.cc:141:18:  [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 len = strlen(msg) + 20;
data/pxe-kexec-0.2.4/ext/libbw/debug.cc:167: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(newmsg);
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt_long.c:189: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).
			current_argv_len = strlen(current_argv);
data/pxe-kexec-0.2.4/ext/libbw/ext/getopt/getopt_long.c:195:8:  [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(long_options[i].name) == (unsigned)current_argv_len) {
data/pxe-kexec-0.2.4/ext/libbw/serialfile_posix.cc:203:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int ret = read(d->fd, buffer, BUFSIZ);
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:26: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).
    str1 = alloca(strlen(a) + 1);
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:27: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).
    str2 = alloca(strlen(b) + 1);
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:90: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).
            if (strlen(one) > strlen(two)) return 1;
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:90:31:  [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(one) > strlen(two)) return 1;
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:91: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).
            if (strlen(two) > strlen(one)) return -1;
data/pxe-kexec-0.2.4/src/ext/rpmvercmp.c:91:31:  [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(two) > strlen(one)) return -1;
data/pxe-kexec-0.2.4/src/linuxdb.cc:307: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).
    setRelease(line.substr(release_pos + strlen("release") + 1,
data/pxe-kexec-0.2.4/src/linuxdb.cc:308:61:  [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).
                           open_bracket_pos - release_pos - strlen("release") - 2));

ANALYSIS SUMMARY:

Hits = 50
Lines analyzed = 7951 in approximately 0.26 seconds (30200 lines/second)
Physical Source Lines of Code (SLOC) = 3379
Hits@level = [0]  10 [1]  18 [2]  15 [3]   9 [4]   8 [5]   0
Hits@level+ = [0+]  60 [1+]  50 [2+]  32 [3+]  17 [4+]   8 [5+]   0
Hits/KSLOC@level+ = [0+] 17.7567 [1+] 14.7973 [2+] 9.47026 [3+] 5.03107 [4+] 2.36756 [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.