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/dhcpoptinj-0.5.3/src/config.c Examining data/dhcpoptinj-0.5.3/src/config.h Examining data/dhcpoptinj-0.5.3/src/dhcp.c Examining data/dhcpoptinj-0.5.3/src/dhcp.h Examining data/dhcpoptinj-0.5.3/src/dhcpoptinj.c Examining data/dhcpoptinj-0.5.3/src/ipv4.c Examining data/dhcpoptinj-0.5.3/src/ipv4.h Examining data/dhcpoptinj-0.5.3/src/options.c Examining data/dhcpoptinj-0.5.3/src/options.h Examining data/dhcpoptinj-0.5.3/src/udp.h FINAL RESULTS: data/dhcpoptinj-0.5.3/src/config.c:533: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(config->pidFile, src); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:504:3: [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(f, format, args1); data/dhcpoptinj-0.5.3/src/config.c:136:16: [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 optVal = getopt_long(argc, argv, "c::dfhio:p::q:rv", options, NULL); data/dhcpoptinj-0.5.3/src/config.c:425:15: [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(filePath, "r"); data/dhcpoptinj-0.5.3/src/config.c:438:2: [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 line[1024]; data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:181:3: [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 packet[MAX_PACKET_SIZE] __attribute__((aligned)); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:346:2: [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(*newData, origPacket, headersSize); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:425:4: [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(newData + newOffset, option, optSize); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:457: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(newData + newOffset, option, optSize); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:530: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 *f = fopen(config->pidFile, "w"); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:660:2: [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 optPayload[UINT8_MAX * 3]; data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:663:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(optPayload + 3*i, "%02X ", option->data[i]); data/dhcpoptinj-0.5.3/src/options.c:81:3: [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(opt->data, data, size); data/dhcpoptinj-0.5.3/src/config.c:377:25: [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 (size_t i = 0; i < strlen(string) && length < sizeof(buffer);) data/dhcpoptinj-0.5.3/src/config.c:525: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). size_t pidFilePathLen = strlen(src); data/dhcpoptinj-0.5.3/src/config.c:627:25: [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 (char *ch = text + strlen(text) - 1; data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:164:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(022); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:517: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). size_t len = strlen(simplifiedName); data/dhcpoptinj-0.5.3/src/dhcpoptinj.c:670: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). size_t optNameLen = strlen(optName); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 2059 in approximately 0.09 seconds (21815 lines/second) Physical Source Lines of Code (SLOC) = 1529 Hits@level = [0] 20 [1] 6 [2] 10 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 39 [1+] 19 [2+] 13 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 25.5069 [1+] 12.4264 [2+] 8.50229 [3+] 1.96207 [4+] 1.30804 [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.