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/nicstat-1.95/nicstat.c FINAL RESULTS: data/nicstat-1.95/nicstat.c:337:9: [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. (void) vfprintf(stderr, format, ap); data/nicstat-1.95/nicstat.c:837:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(ifname, "%s%u", ksp->ks_module, data/nicstat-1.95/nicstat.c:2610:19: [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 ((option = getopt(argc, argv, GETOPT_OPTIONS)) != -1) { data/nicstat-1.95/nicstat.c:643: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 buf[64]; data/nicstat-1.95/nicstat.c:647: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). uptime_fd = open(PROC_UPTIME, O_RDONLY, 0); data/nicstat-1.95/nicstat.c:741: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 link[MAXLINKNAMELEN]; data/nicstat-1.95/nicstat.c:817: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 ifname[MAXLINKNAMELEN]; data/nicstat-1.95/nicstat.c:949:24: [2] (integer) atol: 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). *instance = (uint32_t)atol(++p); data/nicstat-1.95/nicstat.c:972: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 if_drv[MAXLINKNAMELEN]; data/nicstat-1.95/nicstat.c:1099: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 drv[MAXLINKNAMELEN]; data/nicstat-1.95/nicstat.c:1481: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 buf[2048]; data/nicstat-1.95/nicstat.c:1521: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 buf[2048]; data/nicstat-1.95/nicstat.c:1628: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 proc_net_buffer[PROC_NET_BUFSIZ]; data/nicstat-1.95/nicstat.c:1632: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 if_name[32]; data/nicstat-1.95/nicstat.c:1798: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 g_timestr[16]; data/nicstat-1.95/nicstat.c:2345: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 name[32]; data/nicstat-1.95/nicstat.c:2347: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 duplex_s[32]; data/nicstat-1.95/nicstat.c:2547: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 errmsg[DLADM_STRSIZE]; data/nicstat-1.95/nicstat.c:2704:14: [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). interval = atoi(*argv); data/nicstat-1.95/nicstat.c:2709: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). loop_max = atoi(*argv); data/nicstat-1.95/nicstat.c:2748:12: [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). net_dev = open(PROC_NET_DEV_PATH, O_RDONLY, 0); data/nicstat-1.95/nicstat.c:2752: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). g_snmp = fopen(PROC_NET_SNMP_PATH, "r"); data/nicstat-1.95/nicstat.c:2757: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). g_netstat = fopen(PROC_NET_NETSTAT_PATH, "r"); data/nicstat-1.95/nicstat.c:650:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bufsiz = read(uptime_fd, buf, sizeof (buf) - 1); data/nicstat-1.95/nicstat.c:947:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(drv, if_name, n); data/nicstat-1.95/nicstat.c:1603:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, nicp->name, sizeof (ifr.ifr_name)); data/nicstat-1.95/nicstat.c:1640:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bufsiz = read(net_dev, (void *) proc_net_buffer, data/nicstat-1.95/nicstat.c:1694:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(if_name, bufp, n); data/nicstat-1.95/nicstat.c:2353:12: [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. tokens = sscanf(if_record, "%31[^:]:%llu%31s", ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 2900 in approximately 0.08 seconds (38421 lines/second) Physical Source Lines of Code (SLOC) = 2247 Hits@level = [0] 39 [1] 6 [2] 20 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 68 [1+] 29 [2+] 23 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 30.2626 [1+] 12.9061 [2+] 10.2359 [3+] 1.33511 [4+] 0.890076 [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.