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/dhcp-helper-1.2/dhcp-helper.c FINAL RESULTS: data/dhcp-helper-1.2/dhcp-helper.c:171:6: [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(user, optarg); data/dhcp-helper-1.2/dhcp-helper.c:176:6: [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(runfile, optarg); data/dhcp-helper-1.2/dhcp-helper.c:102:20: [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 option = getopt(argc, argv, "b:e:i:s:u:r:dvpn"); data/dhcp-helper-1.2/dhcp-helper.c:63: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 name[IF_NAMESIZE]; data/dhcp-helper-1.2/dhcp-helper.c:80:14: [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. unsigned char chaddr[DHCP_CHADDR_MAX], sname[64], file[128]; data/dhcp-helper-1.2/dhcp-helper.c:82: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. unsigned char options[312]; data/dhcp-helper-1.2/dhcp-helper.c:328: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). if ((pidfile = fopen(runfile, "w"))) data/dhcp-helper-1.2/dhcp-helper.c:366:7: [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 control[CMSG_SPACE(sizeof(struct in_pktinfo))]; data/dhcp-helper-1.2/dhcp-helper.c:550: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(pa, &saddr, sizeof(struct sockaddr_in)); data/dhcp-helper-1.2/dhcp-helper.c:552: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(req.arp_ha.sa_data, packet->chaddr, packet->hlen); data/dhcp-helper-1.2/dhcp-helper.c:119:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(new->name, optarg, IF_NAMESIZE); data/dhcp-helper-1.2/dhcp-helper.c:120:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, optarg, IF_NAMESIZE); data/dhcp-helper-1.2/dhcp-helper.c:134: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). else if (strlen(optarg) > IF_NAMESIZE) data/dhcp-helper-1.2/dhcp-helper.c:170: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). if ((user = malloc(strlen(optarg) + 1))) data/dhcp-helper-1.2/dhcp-helper.c:175:26: [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 ((runfile = malloc(strlen(optarg) + 1))) data/dhcp-helper-1.2/dhcp-helper.c:325:7: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(022); /* make pidfile 0644 */ data/dhcp-helper-1.2/dhcp-helper.c:334:7: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/dhcp-helper-1.2/dhcp-helper.c:494:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, tmp->name, IF_NAMESIZE); data/dhcp-helper-1.2/dhcp-helper.c:553:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(req.arp_dev, ifr.ifr_name, 16); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 564 in approximately 0.04 seconds (14469 lines/second) Physical Source Lines of Code (SLOC) = 441 Hits@level = [0] 12 [1] 9 [2] 7 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 31 [1+] 19 [2+] 10 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 70.2948 [1+] 43.0839 [2+] 22.6757 [3+] 6.80272 [4+] 4.53515 [5+] 0 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.