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/nethogs-0.8.5/src/connection.cpp
Examining data/nethogs-0.8.5/src/connection.h
Examining data/nethogs-0.8.5/src/conninode.cpp
Examining data/nethogs-0.8.5/src/conninode.h
Examining data/nethogs-0.8.5/src/conninode_test.cpp
Examining data/nethogs-0.8.5/src/cui.cpp
Examining data/nethogs-0.8.5/src/cui.h
Examining data/nethogs-0.8.5/src/decpcap.c
Examining data/nethogs-0.8.5/src/decpcap.h
Examining data/nethogs-0.8.5/src/decpcap_test.cpp
Examining data/nethogs-0.8.5/src/devices.cpp
Examining data/nethogs-0.8.5/src/devices.h
Examining data/nethogs-0.8.5/src/inode2prog.cpp
Examining data/nethogs-0.8.5/src/inode2prog.h
Examining data/nethogs-0.8.5/src/libnethogs.cpp
Examining data/nethogs-0.8.5/src/libnethogs.h
Examining data/nethogs-0.8.5/src/main.cpp
Examining data/nethogs-0.8.5/src/nethogs.cpp
Examining data/nethogs-0.8.5/src/nethogs.h
Examining data/nethogs-0.8.5/src/packet.cpp
Examining data/nethogs-0.8.5/src/packet.h
Examining data/nethogs-0.8.5/src/process.cpp
Examining data/nethogs-0.8.5/src/process.h

FINAL RESULTS:

data/nethogs-0.8.5/src/inode2prog.cpp:182:19:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    int usedlen = readlink(fromname, linkname, linklen - 1);
data/nethogs-0.8.5/src/main.cpp:190:16:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    if ((len = readlink("/proc/self/exe", exe_path, PATH_MAX)) == -1)
data/nethogs-0.8.5/src/main.cpp:70: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(stderr, msg, argp);
data/nethogs-0.8.5/src/main.cpp:136:17:  [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 ((opt = getopt(argc, argv, "Vahbtpd:v:c:sa")) != -1) {
data/nethogs-0.8.5/src/conninode.cpp:66: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 rem_addr[128], local_addr[128];
data/nethogs-0.8.5/src/conninode.cpp:162: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).
  FILE *procinfo = fopen(filename, "r");
data/nethogs-0.8.5/src/conninode.cpp:164: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 buffer[8192];
data/nethogs-0.8.5/src/decpcap.c:285: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(userdata_copy, handle->userdata, handle->userdata_size);
data/nethogs-0.8.5/src/inode2prog.cpp:84: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 buf[255];
data/nethogs-0.8.5/src/inode2prog.cpp:99: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).
  int fd = open(filepath, O_RDONLY);
data/nethogs-0.8.5/src/inode2prog.cpp:121: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 filename[maxfilenamelen];
data/nethogs-0.8.5/src/inode2prog.cpp:152: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 dirname[10 + MAX_PID_LENGTH];
data/nethogs-0.8.5/src/inode2prog.cpp:175: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 fromname[10 + MAX_PID_LENGTH + 1 + MAX_FDLINK];
data/nethogs-0.8.5/src/inode2prog.cpp:181: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 linkname[linklen];
data/nethogs-0.8.5/src/libnethogs.cpp:101: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 errbuf[PCAP_ERRBUF_SIZE];
data/nethogs-0.8.5/src/main.cpp:158:22:  [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).
      refreshdelay = atoi(optarg);
data/nethogs-0.8.5/src/main.cpp:161:18:  [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).
      viewMode = atoi(optarg) % VIEWMODE_COUNT;
data/nethogs-0.8.5/src/main.cpp:164:22:  [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).
      refreshlimit = atoi(optarg);
data/nethogs-0.8.5/src/main.cpp:186: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 exe_path[PATH_MAX];
data/nethogs-0.8.5/src/main.cpp:212: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 errbuf[PCAP_ERRBUF_SIZE];
data/nethogs-0.8.5/src/packet.cpp:80: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 host[512];
data/nethogs-0.8.5/src/packet.cpp:239:11:  [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 addy[50];
data/nethogs-0.8.5/src/process.cpp:231: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 procdir[100];
data/nethogs-0.8.5/src/process.cpp:232: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(procdir, "/proc/%d", node->pid);
data/nethogs-0.8.5/src/conninode.cpp:91:7:  [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 (strlen(local_addr) > 8) {
data/nethogs-0.8.5/src/cui.cpp:178:65:  [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).
  mvaddstr_truncate_leading(row, column_offset_program, m_name, strlen(m_name),
data/nethogs-0.8.5/src/inode2prog.cpp:87:30:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  for (int length; (length = read(fd, buf, sizeof(buf))) > 0;) {
data/nethogs-0.8.5/src/inode2prog.cpp:154:24:  [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 dirlen = 10 + strlen(pid);
data/nethogs-0.8.5/src/inode2prog.cpp:174:31:  [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 fromlen = dirlen + strlen(entry->d_name) + 1;
data/nethogs-0.8.5/src/libnethogs.cpp:70:5:  [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(1000);
data/nethogs-0.8.5/src/main.cpp:112:5:  [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(1000);
data/nethogs-0.8.5/src/packet.cpp:204:15:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
  return std::equal(one.s6_addr, one.s6_addr + 16, other.s6_addr);

ANALYSIS SUMMARY:

Hits = 32
Lines analyzed = 3852 in approximately 0.11 seconds (35252 lines/second)
Physical Source Lines of Code (SLOC) = 2490
Hits@level = [0]  36 [1]   8 [2]  20 [3]   1 [4]   1 [5]   2
Hits@level+ = [0+]  68 [1+]  32 [2+]  24 [3+]   4 [4+]   3 [5+]   2
Hits/KSLOC@level+ = [0+] 27.3092 [1+] 12.8514 [2+] 9.63855 [3+] 1.60643 [4+] 1.20482 [5+] 0.803213
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.