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/waybar-0.9.4/include/ALabel.hpp
Examining data/waybar-0.9.4/include/AModule.hpp
Examining data/waybar-0.9.4/include/IModule.hpp
Examining data/waybar-0.9.4/include/bar.hpp
Examining data/waybar-0.9.4/include/client.hpp
Examining data/waybar-0.9.4/include/modules/backlight.hpp
Examining data/waybar-0.9.4/include/modules/battery.hpp
Examining data/waybar-0.9.4/include/modules/bluetooth.hpp
Examining data/waybar-0.9.4/include/modules/cpu.hpp
Examining data/waybar-0.9.4/include/modules/custom.hpp
Examining data/waybar-0.9.4/include/modules/disk.hpp
Examining data/waybar-0.9.4/include/modules/idle_inhibitor.hpp
Examining data/waybar-0.9.4/include/modules/memory.hpp
Examining data/waybar-0.9.4/include/modules/mpd.hpp
Examining data/waybar-0.9.4/include/modules/network.hpp
Examining data/waybar-0.9.4/include/modules/pulseaudio.hpp
Examining data/waybar-0.9.4/include/modules/river/tags.hpp
Examining data/waybar-0.9.4/include/modules/sni/host.hpp
Examining data/waybar-0.9.4/include/modules/sni/item.hpp
Examining data/waybar-0.9.4/include/modules/sni/tray.hpp
Examining data/waybar-0.9.4/include/modules/sni/watcher.hpp
Examining data/waybar-0.9.4/include/modules/sway/ipc/client.hpp
Examining data/waybar-0.9.4/include/modules/sway/ipc/ipc.hpp
Examining data/waybar-0.9.4/include/modules/sway/mode.hpp
Examining data/waybar-0.9.4/include/modules/sway/window.hpp
Examining data/waybar-0.9.4/include/modules/sway/workspaces.hpp
Examining data/waybar-0.9.4/include/modules/temperature.hpp
Examining data/waybar-0.9.4/include/modules/wlr/taskbar.hpp
Examining data/waybar-0.9.4/include/util/clara.hpp
Examining data/waybar-0.9.4/include/util/command.hpp
Examining data/waybar-0.9.4/include/util/format.hpp
Examining data/waybar-0.9.4/include/util/json.hpp
Examining data/waybar-0.9.4/include/util/rfkill.hpp
Examining data/waybar-0.9.4/include/util/sleeper_thread.hpp
Examining data/waybar-0.9.4/include/factory.hpp
Examining data/waybar-0.9.4/src/ALabel.cpp
Examining data/waybar-0.9.4/src/AModule.cpp
Examining data/waybar-0.9.4/src/bar.cpp
Examining data/waybar-0.9.4/src/client.cpp
Examining data/waybar-0.9.4/src/main.cpp
Examining data/waybar-0.9.4/src/modules/backlight.cpp
Examining data/waybar-0.9.4/src/modules/battery.cpp
Examining data/waybar-0.9.4/src/modules/bluetooth.cpp
Examining data/waybar-0.9.4/src/modules/clock.cpp
Examining data/waybar-0.9.4/src/modules/cpu/bsd.cpp
Examining data/waybar-0.9.4/src/modules/cpu/common.cpp
Examining data/waybar-0.9.4/src/modules/cpu/linux.cpp
Examining data/waybar-0.9.4/src/modules/custom.cpp
Examining data/waybar-0.9.4/src/modules/disk.cpp
Examining data/waybar-0.9.4/src/modules/idle_inhibitor.cpp
Examining data/waybar-0.9.4/src/modules/memory/bsd.cpp
Examining data/waybar-0.9.4/src/modules/memory/common.cpp
Examining data/waybar-0.9.4/src/modules/memory/linux.cpp
Examining data/waybar-0.9.4/src/modules/mpd.cpp
Examining data/waybar-0.9.4/src/modules/network.cpp
Examining data/waybar-0.9.4/src/modules/pulseaudio.cpp
Examining data/waybar-0.9.4/src/modules/river/tags.cpp
Examining data/waybar-0.9.4/src/modules/sni/host.cpp
Examining data/waybar-0.9.4/src/modules/sni/item.cpp
Examining data/waybar-0.9.4/src/modules/sni/tray.cpp
Examining data/waybar-0.9.4/src/modules/sni/watcher.cpp
Examining data/waybar-0.9.4/src/modules/sway/ipc/client.cpp
Examining data/waybar-0.9.4/src/modules/sway/mode.cpp
Examining data/waybar-0.9.4/src/modules/sway/window.cpp
Examining data/waybar-0.9.4/src/modules/sway/workspaces.cpp
Examining data/waybar-0.9.4/src/modules/temperature.cpp
Examining data/waybar-0.9.4/src/modules/wlr/taskbar.cpp
Examining data/waybar-0.9.4/src/util/rfkill.cpp
Examining data/waybar-0.9.4/src/factory.cpp

FINAL RESULTS:

data/waybar-0.9.4/include/util/command.hpp:83:5:  [4] (shell) execlp:
  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.
    execlp("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0);
data/waybar-0.9.4/include/util/command.hpp:128:5:  [4] (shell) execl:
  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.
    execl("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0);
data/waybar-0.9.4/src/client.cpp:19:11:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
      if (access(*p.we_wordv, F_OK) == 0) {
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:40:15:  [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 ((in = popen("sway --get-socketpath 2>/dev/null", "r")) == nullptr) {
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:31:21:  [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.
  const char* env = getenv("SWAYSOCK");
data/waybar-0.9.4/src/modules/wlr/taskbar.cpp:50:31:  [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.
    auto xdg_data_dirs = std::getenv("XDG_DATA_DIRS");
data/waybar-0.9.4/include/modules/sway/ipc/client.hpp:39:23:  [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                 open(const std::string &) const;
data/waybar-0.9.4/include/util/command.hpp:61: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).
inline FILE* open(const std::string& cmd, int& pid) {
data/waybar-0.9.4/include/util/command.hpp:94:22:  [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).
  auto fp = command::open(cmd, pid);
data/waybar-0.9.4/include/util/command.hpp:103:22:  [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).
  auto fp = command::open(cmd, pid);
data/waybar-0.9.4/src/modules/custom.cpp:46:24:  [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).
  fp_ = util::command::open(cmd, pid_);
data/waybar-0.9.4/src/modules/custom.cpp:67:30:  [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).
        fp_ = util::command::open(cmd, pid_);
data/waybar-0.9.4/src/modules/network.cpp:114: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 ifname[IF_NAMESIZE];
data/waybar-0.9.4/src/modules/network.cpp:352: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                  resp[route_buffer_size] = {0};
data/waybar-0.9.4/src/modules/network.cpp:357: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               req[reqlen] = {0};
data/waybar-0.9.4/src/modules/network.cpp:480: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 ipaddr[INET6_ADDRSTRLEN];
data/waybar-0.9.4/src/modules/network.cpp:481: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 netmask[INET6_ADDRSTRLEN];
data/waybar-0.9.4/src/modules/network.cpp:619: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 ifname[IF_NAMESIZE];
data/waybar-0.9.4/src/modules/network.cpp:651: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 ifname[IF_NAMESIZE];
data/waybar-0.9.4/src/modules/network.cpp:670: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 ifname[IF_NAMESIZE];
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:8:9:  [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).
  fd_ = open(socketPath);
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:9:15:  [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).
  fd_event_ = open(socketPath);
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:39: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        buf[512] = {0};
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:58:10:  [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 Ipc::open(const std::string& socketPath) const {
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:118: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(header.data(), ipc_magic_.c_str(), ipc_magic_.size());
data/waybar-0.9.4/src/util/rfkill.cpp:39:8:  [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).
  fd = open("/dev/rfkill", O_RDONLY);
data/waybar-0.9.4/include/util/command.hpp:20:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
inline std::string read(FILE* fp) {
data/waybar-0.9.4/include/util/command.hpp:96:26:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  auto output = command::read(fp);
data/waybar-0.9.4/src/modules/battery.cpp:35:35:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int                  nbytes = read(fd_, &event, sizeof(event));
data/waybar-0.9.4/src/modules/network.cpp:35:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  std::string read;
data/waybar-0.9.4/src/modules/network.cpp:36:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while (std::getline(netstat, read) && !starts_with(read, category))
data/waybar-0.9.4/src/modules/network.cpp:36:54:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while (std::getline(netstat, read) && !starts_with(read, category))
data/waybar-0.9.4/src/modules/network.cpp:38:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if (!starts_with(read, category)) {
data/waybar-0.9.4/src/modules/network.cpp:46:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  auto r_it = read.begin();
data/waybar-0.9.4/src/modules/network.cpp:48:39:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while (k_it != key.end() && r_it != read.end()) {
data/waybar-0.9.4/src/modules/network.cpp:50:30:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      r_it = std::find(r_it, read.end(), ' ');
data/waybar-0.9.4/src/modules/network.cpp:51:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if (r_it != read.end()) {
data/waybar-0.9.4/src/modules/network.cpp:62:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if (r_it == read.end() && k_it != key.end()) {
data/waybar-0.9.4/src/modules/network.cpp:70:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  std::getline(netstat, read);
data/waybar-0.9.4/src/modules/network.cpp:71:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  assert(starts_with(read, category));
data/waybar-0.9.4/src/modules/network.cpp:72:26:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  std::istringstream iss(read);
data/waybar-0.9.4/src/modules/network.cpp:74:23:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    std::getline(iss, read, ' ');
data/waybar-0.9.4/src/modules/sni/item.cpp:172:32:  [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.
      if (!old_value || !value.equal(old_value)) {
data/waybar-0.9.4/src/modules/sway/ipc/client.cpp:67:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path) - 1);
data/waybar-0.9.4/src/util/rfkill.cpp:58:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    len = read(fd, &event, sizeof(event));

ANALYSIS SUMMARY:

Hits = 45
Lines analyzed = 9463 in approximately 0.25 seconds (38018 lines/second)
Physical Source Lines of Code (SLOC) = 7929
Hits@level = [0]   7 [1]  19 [2]  20 [3]   2 [4]   4 [5]   0
Hits@level+ = [0+]  52 [1+]  45 [2+]  26 [3+]   6 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 6.5582 [1+] 5.67537 [2+] 3.2791 [3+] 0.756716 [4+] 0.504477 [5+]   0
Dot directories skipped = 2 (--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.