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/arpon-3.0-ng+dfsg1/src/darpi.c Examining data/arpon-3.0-ng+dfsg1/src/intf.h Examining data/arpon-3.0-ng+dfsg1/src/proc.c Examining data/arpon-3.0-ng+dfsg1/src/proc.h Examining data/arpon-3.0-ng+dfsg1/src/env.c Examining data/arpon-3.0-ng+dfsg1/src/rt.h Examining data/arpon-3.0-ng+dfsg1/src/darpi.h Examining data/arpon-3.0-ng+dfsg1/src/std.h Examining data/arpon-3.0-ng+dfsg1/src/opt.h Examining data/arpon-3.0-ng+dfsg1/src/env.h Examining data/arpon-3.0-ng+dfsg1/src/exit.h Examining data/arpon-3.0-ng+dfsg1/src/intf.c Examining data/arpon-3.0-ng+dfsg1/src/rt.c Examining data/arpon-3.0-ng+dfsg1/src/sig.h Examining data/arpon-3.0-ng+dfsg1/src/ver.h Examining data/arpon-3.0-ng+dfsg1/src/sarpi.h Examining data/arpon-3.0-ng+dfsg1/src/msg.h Examining data/arpon-3.0-ng+dfsg1/src/main.c Examining data/arpon-3.0-ng+dfsg1/src/unused.h Examining data/arpon-3.0-ng+dfsg1/src/dmn.h Examining data/arpon-3.0-ng+dfsg1/src/sarpi.c Examining data/arpon-3.0-ng+dfsg1/src/thd.c Examining data/arpon-3.0-ng+dfsg1/src/exit.c Examining data/arpon-3.0-ng+dfsg1/src/ispn.h Examining data/arpon-3.0-ng+dfsg1/src/thd.h Examining data/arpon-3.0-ng+dfsg1/src/ispn.c Examining data/arpon-3.0-ng+dfsg1/src/harpi.c Examining data/arpon-3.0-ng+dfsg1/src/dmn.c Examining data/arpon-3.0-ng+dfsg1/src/arpca.c Examining data/arpon-3.0-ng+dfsg1/src/queue.h Examining data/arpon-3.0-ng+dfsg1/src/harpi.h Examining data/arpon-3.0-ng+dfsg1/src/std.c Examining data/arpon-3.0-ng+dfsg1/src/darpica.c Examining data/arpon-3.0-ng+dfsg1/src/sarpica.h Examining data/arpon-3.0-ng+dfsg1/src/darpica.h Examining data/arpon-3.0-ng+dfsg1/src/arpca.h Examining data/arpon-3.0-ng+dfsg1/src/msg.c Examining data/arpon-3.0-ng+dfsg1/src/sarpica.c Examining data/arpon-3.0-ng+dfsg1/src/opt.c Examining data/arpon-3.0-ng+dfsg1/src/sig.c FINAL RESULTS: data/arpon-3.0-ng+dfsg1/src/dmn.c:289:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(PID_FILE, DMN_PIDPERMS) < 0) data/arpon-3.0-ng+dfsg1/src/msg.c:200:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(LOG_FILE, MSG_LOGPERMS) < 0) data/arpon-3.0-ng+dfsg1/src/sarpica.c:229:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(ETC_FILE, SARPICA_ETCPERMS) < 0) data/arpon-3.0-ng+dfsg1/src/msg.c:131:21: [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. if ((len2 = vsnprintf(&msg[len1], (size_t)tot_len, fmt, ap)) < 0) data/arpon-3.0-ng+dfsg1/src/msg.h:45:5: [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(fmt "\n", ##__VA_ARGS__); \ data/arpon-3.0-ng+dfsg1/src/env.c:67:13: [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. if (getenv(ENV_LDPRELOAD) != NULL) { data/arpon-3.0-ng+dfsg1/src/opt.c:182:20: [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. while ((gopt = getopt_long(argc, argv, short_opt, long_opt, NULL)) != -1) { data/arpon-3.0-ng+dfsg1/src/darpi.c:59: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 smacsrc[INTF_ETHERSTRLEN], sipsrc[INET_ADDRSTRLEN], data/arpon-3.0-ng+dfsg1/src/dmn.c:218:19: [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 ((fd = open(DMN_NULLDEV, O_RDWR, 0)) < 0) data/arpon-3.0-ng+dfsg1/src/dmn.c:265:27: [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 ((fd = open(PID_FILE, O_CREAT, DMN_PIDPERMS)) < 0) data/arpon-3.0-ng+dfsg1/src/dmn.c:293:20: [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 ((pid = fopen(PID_FILE, "w")) == NULL) data/arpon-3.0-ng+dfsg1/src/harpi.c:60: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 smacsrc[INTF_ETHERSTRLEN], sipsrc[INET_ADDRSTRLEN], data/arpon-3.0-ng+dfsg1/src/intf.c:162: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 pcap_errbuf[PCAP_ERRBUF_SIZE]; /* Pcap error buffer. */ data/arpon-3.0-ng+dfsg1/src/intf.c:166: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 lnet_errbuf[LIBNET_ERRBUF_SIZE]; /* Libnet error buffer. */ data/arpon-3.0-ng+dfsg1/src/intf.c:542: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(&cfg->mac.ether_addr_octet, mac->ether_addr_octet, (size_t)ETH_ALEN); data/arpon-3.0-ng+dfsg1/src/intf.c:825: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(macsrc.ether_addr_octet, harp->arp_sha, ETH_ALEN); data/arpon-3.0-ng+dfsg1/src/intf.c:829: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(&ipsrc.s_addr, harp->arp_spa, INTF_IP_ALEN); data/arpon-3.0-ng+dfsg1/src/intf.c:849: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(macdst.ether_addr_octet, harp->arp_tha, ETH_ALEN); data/arpon-3.0-ng+dfsg1/src/intf.c:853: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(&ipdst.s_addr, harp->arp_tpa, INTF_IP_ALEN); data/arpon-3.0-ng+dfsg1/src/msg.c:98: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 ts[MSG_TIMESTAMPSIZE], msg[MSG_MESSAGESIZE]; data/arpon-3.0-ng+dfsg1/src/msg.c:173:27: [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 ((fd = open(LOG_FILE, O_CREAT, MSG_LOGPERMS)) < 0) data/arpon-3.0-ng+dfsg1/src/msg.c:204:20: [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 ((log = fopen(LOG_FILE, "a")) == NULL) data/arpon-3.0-ng+dfsg1/src/opt.c:61: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 interface[IF_NAMESIZE]; /* Interface name command option. */ data/arpon-3.0-ng+dfsg1/src/opt.c:294: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(opt->interface, interface, len); data/arpon-3.0-ng+dfsg1/src/proc.c:261:21: [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 ((file = fopen(path, "w")) == NULL) data/arpon-3.0-ng+dfsg1/src/proc.c:314: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(path, PROC_ROOTPATH, len1); data/arpon-3.0-ng+dfsg1/src/proc.c:318: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(&path[tot_len], interface, len2); data/arpon-3.0-ng+dfsg1/src/proc.c:322: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(&path[tot_len], file, len3); data/arpon-3.0-ng+dfsg1/src/proc.c:361:21: [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 ((file = fopen(path, "r")) == NULL) data/arpon-3.0-ng+dfsg1/src/sarpi.c:59: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 smacsrc[INTF_ETHERSTRLEN], sipsrc[INET_ADDRSTRLEN], data/arpon-3.0-ng+dfsg1/src/sarpica.c:233:21: [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 ((conf = fopen(ETC_FILE, "r")) == NULL) data/arpon-3.0-ng+dfsg1/src/sarpica.c:252: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 line[SARPICA_LINESIZE]; data/arpon-3.0-ng+dfsg1/src/sarpica.c:259: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 sip[INET_ADDRSTRLEN], smac[INTF_ETHERSTRLEN]; data/arpon-3.0-ng+dfsg1/src/arpca.c:439:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ar.arp_dev, interface, IF_NAMESIZE); data/arpon-3.0-ng+dfsg1/src/darpi.c:69:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN); data/arpon-3.0-ng+dfsg1/src/darpi.c:72:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN); data/arpon-3.0-ng+dfsg1/src/darpi.c:76:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN); data/arpon-3.0-ng+dfsg1/src/darpi.c:79:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN); data/arpon-3.0-ng+dfsg1/src/dmn.c:203:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(DMN_USERMASK); data/arpon-3.0-ng+dfsg1/src/harpi.c:71:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN); data/arpon-3.0-ng+dfsg1/src/harpi.c:74:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN); data/arpon-3.0-ng+dfsg1/src/harpi.c:78:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN); data/arpon-3.0-ng+dfsg1/src/harpi.c:81:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN); data/arpon-3.0-ng+dfsg1/src/opt.c:280: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(interface); data/arpon-3.0-ng+dfsg1/src/proc.c:298:12: [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). len1 = strlen(PROC_ROOTPATH); data/arpon-3.0-ng+dfsg1/src/proc.c:299:12: [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). len2 = strlen(interface); data/arpon-3.0-ng+dfsg1/src/proc.c:300:12: [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). len3 = strlen(file); data/arpon-3.0-ng+dfsg1/src/sarpi.c:70:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN); data/arpon-3.0-ng+dfsg1/src/sarpi.c:73:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN); data/arpon-3.0-ng+dfsg1/src/sarpi.c:77:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN); data/arpon-3.0-ng+dfsg1/src/sarpi.c:80:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN); data/arpon-3.0-ng+dfsg1/src/sarpica.c:288:13: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf(q, "%15s %17s", sip, smac) != 2) { ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 8075 in approximately 0.23 seconds (35034 lines/second) Physical Source Lines of Code (SLOC) = 3416 Hits@level = [0] 8 [1] 19 [2] 26 [3] 2 [4] 2 [5] 3 Hits@level+ = [0+] 60 [1+] 52 [2+] 33 [3+] 7 [4+] 5 [5+] 3 Hits/KSLOC@level+ = [0+] 17.5644 [1+] 15.2225 [2+] 9.66042 [3+] 2.04918 [4+] 1.4637 [5+] 0.87822 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.