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/arping-2.21/src/findif_getifaddrs.c Examining data/arping-2.21/src/findif_other.c Examining data/arping-2.21/src/findif_sysctl.c Examining data/arping-2.21/src/fuzz_pingmac.c Examining data/arping-2.21/src/arping_main.c Examining data/arping-2.21/src/arping_test.c Examining data/arping-2.21/src/arping.c Examining data/arping-2.21/src/windows.c Examining data/arping-2.21/src/findif_bsdroute.c Examining data/arping-2.21/src/arping.h Examining data/arping-2.21/src/unix.c Examining data/arping-2.21/src/mock_libnet.c Examining data/arping-2.21/src/fuzz_pingip.c Examining data/arping-2.21/src/mock_libpcap.c Examining data/arping-2.21/src/findif_linux.c FINAL RESULTS: data/arping-2.21/src/arping.c:559:25: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, fmt, "Name", "Description"); data/arping-2.21/src/arping.c:561:33: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, fmt, pcap_tstamp_type_val_to_name(ts[c]), data/arping-2.21/src/arping.c:901:26: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (6 == sscanf(in, formats[c], data/arping-2.21/src/arping_test.c:466:17: [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(buf, tests[c][0]); data/arping-2.21/src/findif_bsdroute.c:60:12: [4] (shell) popen: 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. if (!(f = popen(buf, "r"))) { data/arping-2.21/src/findif_linux.c:64:12: [4] (shell) popen: 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. if (!(f = popen(buf, "r"))) { data/arping-2.21/src/arping.c:230:24: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. p[n] = random() & 0xff; data/arping-2.21/src/arping.c:282:13: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(pw->pw_dir)) { data/arping-2.21/src/arping.c:1708:9: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(time(NULL)); data/arping-2.21/src/arping.c:1722:28: [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. while (EOF != (c = getopt(argc, argv, data/arping-2.21/src/arping.c:191:8: [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 char lastreplymac[ETH_ALEN]; /* if last different from this then dup */ data/arping-2.21/src/arping.c:594: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 buf[PATH_MAX]; data/arping-2.21/src/arping.c:634: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 ebuf[LIBNET_ERRBUF_SIZE]; data/arping-2.21/src/arping.c:1022:17: [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(padding, &ts, sizeof(struct timespec)); data/arping-2.21/src/arping.c:1023:17: [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(&padding[sizeof(struct timespec)], data/arping-2.21/src/arping.c:1274:17: [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 buf[128]; data/arping-2.21/src/arping.c:1290: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(&ip, (char*)harp + harp->ar_hln + LIBNET_ARP_H, 4); data/arping-2.21/src/arping.c:1299: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 buf[128]; data/arping-2.21/src/arping.c:1348: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(lastreplymac, pkt_srcmac, ETH_ALEN); data/arping-2.21/src/arping.c:1416:17: [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(&tmp, &hip->ip_src, 4); data/arping-2.21/src/arping.c:1468: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 buf[128]; data/arping-2.21/src/arping.c:1469: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 buf2[128]; data/arping-2.21/src/arping.c:1682: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 ebuf[LIBNET_ERRBUF_SIZE + PCAP_ERRBUF_SIZE]; data/arping-2.21/src/arping.c:1706: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 bpf_filter[64]; data/arping-2.21/src/arping.c:1720: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(dstmac, ethxmas, ETH_ALEN); data/arping-2.21/src/arping.c:1743:15: [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). maxcount = atoi(optarg); data/arping-2.21/src/arping.c:1746:39: [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). max_replies = atoi(optarg); data/arping-2.21/src/arping.c:1794:37: [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). vlan_prio = atoi(optarg); data/arping-2.21/src/arping.c:1837:15: [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). vlan_tag = atoi(optarg); data/arping-2.21/src/arping.c:2186: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(srcmac, cp, ETH_ALEN); data/arping-2.21/src/arping.c:2202:17: [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 buf[128]; data/arping-2.21/src/arping_test.c:195: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(heth->_802_3_dhost, "\x11\x22\x33\x44\x55\x66", 6); data/arping-2.21/src/arping_test.c:196: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(heth->_802_3_shost, "\x77\x88\x99\xaa\xbb\xcc", 6); data/arping-2.21/src/arping_test.c:207: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((char*)harp + LIBNET_ARP_H, heth->_802_3_shost, 6); data/arping-2.21/src/arping_test.c:208: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((char*)harp + LIBNET_ARP_H + harp->ar_hln, &dstip, 4); data/arping-2.21/src/arping_test.c:210: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((char*)harp + LIBNET_ARP_H data/arping-2.21/src/arping_test.c:213: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((char*)harp + LIBNET_ARP_H data/arping-2.21/src/arping_test.c:313:17: [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((char*)harp + harp->ar_hln + LIBNET_ARP_H, &wrongip, 4); data/arping-2.21/src/arping_test.c:396: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(srcmac, "\x11\x22\x33\x44\x55\x66", ETH_ALEN); data/arping-2.21/src/arping_test.c:465:17: [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 buf[128]; data/arping-2.21/src/arping_test.c:498:17: [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 buf[6]; data/arping-2.21/src/arping_test.c:515:17: [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 buf[6]; data/arping-2.21/src/findif_bsdroute.c:45: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. static char buf[10240]; data/arping-2.21/src/findif_bsdroute.c:46: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 buf1[1024]; data/arping-2.21/src/findif_getifaddrs.c:59:16: [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 char ifname[IFNAMSIZ]; data/arping-2.21/src/findif_linux.c:47: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. static char buf[1024]; data/arping-2.21/src/findif_linux.c:48: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 buf1[1024]; data/arping-2.21/src/findif_linux.c:49: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 buf2[1024]; data/arping-2.21/src/findif_sysctl.c:91:16: [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 char ifName[IFNAMSIZ]; data/arping-2.21/src/findif_sysctl.c:129:17: [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 tmpIfName[IFNAMSIZ]; data/arping-2.21/src/findif_sysctl.c:146:17: [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(tmpIfName, sdl->sdl_data, i); data/arping-2.21/src/arping.c:620: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). for (n = strlen(s); n && (s[n - 1] == '\n'); --n) { data/arping-2.21/src/arping.c:847: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). if (3*5-1 == strlen(p)) { data/arping-2.21/src/arping.c:849: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). for (c = 0; c < strlen(p); c++) { data/arping-2.21/src/arping.c:863: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). if (6*3-1 == strlen(p)) { data/arping-2.21/src/arping.c:865: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). for (c = 0; c < strlen(p); c++) { data/arping-2.21/src/arping.c:1650:11: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1); data/arping-2.21/src/arping.c:1890:47: [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). payload_suffix_size = strlen(payload_suffix); data/arping-2.21/src/arping_test.c:110:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(out->reader_fd, cur, n); data/arping-2.21/src/arping_test.c:279: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:292: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:304: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:318: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:330: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:341: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:374: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). fail_unless(strlen(sout->buffer) == 0, sout->buffer); data/arping-2.21/src/arping_test.c:386: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). fail_unless(strlen(sout->buffer) == 0); data/arping-2.21/src/arping_test.c:438:40: [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). sout->buffer, strlen(sout->buffer), data/arping-2.21/src/arping_test.c:439:44: [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). correct0, strlen(correct0))); data/arping-2.21/src/arping_test.c:440:54: [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). fail_unless(!strncmp(sout->buffer, correct0, strlen(correct0)), emsg); data/arping-2.21/src/findif_bsdroute.c:92:14: [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). p += strlen(head); data/arping-2.21/src/findif_getifaddrs.c:96:25: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifname, cur->ifa_name, sizeof(ifname)-1); data/arping-2.21/src/findif_linux.c:96:14: [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). p += strlen(head); data/arping-2.21/src/fuzz_pingip.c:44:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t n = read(STDIN_FILENO, p, size); data/arping-2.21/src/fuzz_pingmac.c:24:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t n = read(STDIN_FILENO, p, size); data/arping-2.21/src/windows.c:71:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(10); ANALYSIS SUMMARY: Hits = 76 Lines analyzed = 4117 in approximately 0.14 seconds (30333 lines/second) Physical Source Lines of Code (SLOC) = 3019 Hits@level = [0] 196 [1] 25 [2] 41 [3] 4 [4] 6 [5] 0 Hits@level+ = [0+] 272 [1+] 76 [2+] 51 [3+] 10 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 90.0961 [1+] 25.1739 [2+] 16.893 [3+] 3.31236 [4+] 1.98741 [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.