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/snapcast-0.19.0/client/browseZeroConf/browse_avahi.cpp
Examining data/snapcast-0.19.0/client/browseZeroConf/browse_avahi.hpp
Examining data/snapcast-0.19.0/client/browseZeroConf/browse_bonjour.cpp
Examining data/snapcast-0.19.0/client/browseZeroConf/browse_bonjour.hpp
Examining data/snapcast-0.19.0/client/browseZeroConf/browse_mdns.hpp
Examining data/snapcast-0.19.0/client/client_connection.cpp
Examining data/snapcast-0.19.0/client/client_connection.hpp
Examining data/snapcast-0.19.0/client/client_settings.hpp
Examining data/snapcast-0.19.0/client/controller.cpp
Examining data/snapcast-0.19.0/client/controller.hpp
Examining data/snapcast-0.19.0/client/decoder/decoder.hpp
Examining data/snapcast-0.19.0/client/decoder/flac_decoder.cpp
Examining data/snapcast-0.19.0/client/decoder/flac_decoder.hpp
Examining data/snapcast-0.19.0/client/decoder/ogg_decoder.cpp
Examining data/snapcast-0.19.0/client/decoder/ogg_decoder.hpp
Examining data/snapcast-0.19.0/client/decoder/opus_decoder.cpp
Examining data/snapcast-0.19.0/client/decoder/opus_decoder.hpp
Examining data/snapcast-0.19.0/client/decoder/pcm_decoder.cpp
Examining data/snapcast-0.19.0/client/decoder/pcm_decoder.hpp
Examining data/snapcast-0.19.0/client/double_buffer.hpp
Examining data/snapcast-0.19.0/client/metadata.hpp
Examining data/snapcast-0.19.0/client/player/alsa_player.cpp
Examining data/snapcast-0.19.0/client/player/alsa_player.hpp
Examining data/snapcast-0.19.0/client/player/coreaudio_player.cpp
Examining data/snapcast-0.19.0/client/player/coreaudio_player.hpp
Examining data/snapcast-0.19.0/client/player/oboe_player.cpp
Examining data/snapcast-0.19.0/client/player/oboe_player.hpp
Examining data/snapcast-0.19.0/client/player/opensl_player.cpp
Examining data/snapcast-0.19.0/client/player/opensl_player.hpp
Examining data/snapcast-0.19.0/client/player/pcm_device.hpp
Examining data/snapcast-0.19.0/client/player/player.cpp
Examining data/snapcast-0.19.0/client/player/player.hpp
Examining data/snapcast-0.19.0/client/snapclient.cpp
Examining data/snapcast-0.19.0/client/stream.cpp
Examining data/snapcast-0.19.0/client/stream.hpp
Examining data/snapcast-0.19.0/client/time_provider.cpp
Examining data/snapcast-0.19.0/client/time_provider.hpp
Examining data/snapcast-0.19.0/common/aixlog.hpp
Examining data/snapcast-0.19.0/common/daemon.cpp
Examining data/snapcast-0.19.0/common/daemon.hpp
Examining data/snapcast-0.19.0/common/endian.hpp
Examining data/snapcast-0.19.0/common/json.hpp
Examining data/snapcast-0.19.0/common/message/codec_header.hpp
Examining data/snapcast-0.19.0/common/message/factory.hpp
Examining data/snapcast-0.19.0/common/message/hello.hpp
Examining data/snapcast-0.19.0/common/message/json_message.hpp
Examining data/snapcast-0.19.0/common/message/message.hpp
Examining data/snapcast-0.19.0/common/message/pcm_chunk.hpp
Examining data/snapcast-0.19.0/common/message/server_settings.hpp
Examining data/snapcast-0.19.0/common/message/stream_tags.hpp
Examining data/snapcast-0.19.0/common/message/time.hpp
Examining data/snapcast-0.19.0/common/message/wire_chunk.hpp
Examining data/snapcast-0.19.0/common/popl.hpp
Examining data/snapcast-0.19.0/common/queue.h
Examining data/snapcast-0.19.0/common/sample_format.cpp
Examining data/snapcast-0.19.0/common/sample_format.hpp
Examining data/snapcast-0.19.0/common/signal_handler.hpp
Examining data/snapcast-0.19.0/common/snap_exception.hpp
Examining data/snapcast-0.19.0/common/str_compat.hpp
Examining data/snapcast-0.19.0/common/time_defs.hpp
Examining data/snapcast-0.19.0/common/utils.hpp
Examining data/snapcast-0.19.0/common/utils/file_utils.hpp
Examining data/snapcast-0.19.0/common/utils/string_utils.hpp
Examining data/snapcast-0.19.0/server/config.cpp
Examining data/snapcast-0.19.0/server/config.hpp
Examining data/snapcast-0.19.0/server/control_server.cpp
Examining data/snapcast-0.19.0/server/control_server.hpp
Examining data/snapcast-0.19.0/server/control_session.hpp
Examining data/snapcast-0.19.0/server/control_session_http.cpp
Examining data/snapcast-0.19.0/server/control_session_http.hpp
Examining data/snapcast-0.19.0/server/control_session_tcp.cpp
Examining data/snapcast-0.19.0/server/control_session_tcp.hpp
Examining data/snapcast-0.19.0/server/encoder/encoder.hpp
Examining data/snapcast-0.19.0/server/encoder/encoder_factory.cpp
Examining data/snapcast-0.19.0/server/encoder/encoder_factory.hpp
Examining data/snapcast-0.19.0/server/encoder/flac_encoder.cpp
Examining data/snapcast-0.19.0/server/encoder/flac_encoder.hpp
Examining data/snapcast-0.19.0/server/encoder/ogg_encoder.cpp
Examining data/snapcast-0.19.0/server/encoder/ogg_encoder.hpp
Examining data/snapcast-0.19.0/server/encoder/opus_encoder.cpp
Examining data/snapcast-0.19.0/server/encoder/opus_encoder.hpp
Examining data/snapcast-0.19.0/server/encoder/pcm_encoder.cpp
Examining data/snapcast-0.19.0/server/encoder/pcm_encoder.hpp
Examining data/snapcast-0.19.0/server/jsonrpcpp.hpp
Examining data/snapcast-0.19.0/server/publishZeroConf/publish_avahi.cpp
Examining data/snapcast-0.19.0/server/publishZeroConf/publish_avahi.hpp
Examining data/snapcast-0.19.0/server/publishZeroConf/publish_bonjour.cpp
Examining data/snapcast-0.19.0/server/publishZeroConf/publish_bonjour.hpp
Examining data/snapcast-0.19.0/server/publishZeroConf/publish_mdns.hpp
Examining data/snapcast-0.19.0/server/server_settings.hpp
Examining data/snapcast-0.19.0/server/snapserver.cpp
Examining data/snapcast-0.19.0/server/stream_server.cpp
Examining data/snapcast-0.19.0/server/stream_server.hpp
Examining data/snapcast-0.19.0/server/stream_session.cpp
Examining data/snapcast-0.19.0/server/stream_session.hpp
Examining data/snapcast-0.19.0/server/streamreader/airplay_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/airplay_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/asio_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/base64.cpp
Examining data/snapcast-0.19.0/server/streamreader/base64.h
Examining data/snapcast-0.19.0/server/streamreader/file_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/file_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/librespot_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/librespot_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/pcm_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/pcm_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/pipe_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/pipe_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/posix_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/posix_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/process_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/process_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/stream_manager.cpp
Examining data/snapcast-0.19.0/server/streamreader/stream_manager.hpp
Examining data/snapcast-0.19.0/server/streamreader/stream_uri.cpp
Examining data/snapcast-0.19.0/server/streamreader/stream_uri.hpp
Examining data/snapcast-0.19.0/server/streamreader/tcp_stream.cpp
Examining data/snapcast-0.19.0/server/streamreader/tcp_stream.hpp
Examining data/snapcast-0.19.0/server/streamreader/watchdog.cpp
Examining data/snapcast-0.19.0/server/streamreader/watchdog.hpp

FINAL RESULTS:

data/snapcast-0.19.0/common/daemon.cpp:95:9:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
    if (chown(pidfile_.c_str(), user_uid, user_gid) == -1)
data/snapcast-0.19.0/common/utils/file_utils.hpp:70:9:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
    if (chown(file_path.c_str(), uid, gid) == -1)
data/snapcast-0.19.0/server/streamreader/process_stream.cpp:73: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.
    ssize_t len = readlink(szTmp, buff, sizeof(buff) - 1);
data/snapcast-0.19.0/client/client_connection.cpp:95:16:  [4] (shell) system:
  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.
        boost::system::error_code ec;
data/snapcast-0.19.0/common/utils.hpp:65:32:  [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.
    std::shared_ptr<FILE> pipe(popen((cmd + " 2> /dev/null").c_str(), "r"), pclose);
data/snapcast-0.19.0/common/utils.hpp:225:9:  [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(ifr.ifr_name, it->ifr_name);
data/snapcast-0.19.0/server/control_server.cpp:149:33:  [4] (shell) system:
  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.
            catch (const boost::system::system_error& e)
data/snapcast-0.19.0/server/control_server.cpp:165:33:  [4] (shell) system:
  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.
            catch (const boost::system::system_error& e)
data/snapcast-0.19.0/server/control_session_http.cpp:119:93:  [4] (shell) system:
  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.
                                                                                     boost::system::error_code ec, std::size_t bytes) { on_read(ec, bytes); }));
data/snapcast-0.19.0/server/control_session_http.cpp:203:22:  [4] (shell) system:
  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 (ec == boost::system::errc::no_such_file_or_directory)
data/snapcast-0.19.0/server/control_session_http.cpp:355:12:  [4] (shell) system:
  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.
    boost::system::error_code ec;
data/snapcast-0.19.0/server/control_session_tcp.cpp:82:12:  [4] (shell) system:
  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.
    boost::system::error_code ec;
data/snapcast-0.19.0/server/control_session_tcp.cpp:126:12:  [4] (shell) system:
  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.
    boost::system::error_code ec;
data/snapcast-0.19.0/server/publishZeroConf/publish_avahi.cpp:68:43:  [4] (shell) system:
  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.
    timer_.async_wait([this](const boost::system::error_code& ec) {
data/snapcast-0.19.0/server/snapserver.cpp:285:55:  [4] (shell) system:
  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.
        signals.async_wait([&io_context](const boost::system::error_code& ec, int signal) {
data/snapcast-0.19.0/server/stream_server.cpp:723:46:  [4] (shell) system:
  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.
    config_timer_.async_wait([](const boost::system::error_code& ec) {
data/snapcast-0.19.0/server/stream_server.cpp:832:33:  [4] (shell) system:
  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.
            catch (const boost::system::system_error& e)
data/snapcast-0.19.0/server/stream_session.cpp:49:108:  [4] (shell) system:
  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.
                            boost::asio::bind_executor(strand_, [ this, self = shared_from_this() ](boost::system::error_code ec, std::size_t length) mutable {
data/snapcast-0.19.0/server/stream_session.cpp:78:93:  [4] (shell) system:
  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.
                                    boost::asio::bind_executor(strand_, [this, self](boost::system::error_code ec, std::size_t length) mutable {
data/snapcast-0.19.0/server/stream_session.cpp:118:12:  [4] (shell) system:
  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.
    boost::system::error_code ec;
data/snapcast-0.19.0/server/stream_session.cpp:134:117:  [4] (shell) system:
  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.
                             boost::asio::bind_executor(strand_, [ this, self = shared_from_this(), buffer ](boost::system::error_code ec, std::size_t length) {
data/snapcast-0.19.0/server/streamreader/asio_stream.hpp:71:66:  [4] (shell) system:
  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.
    timer.async_wait([handler = std::move(handler)](const boost::system::error_code& ec) {
data/snapcast-0.19.0/server/streamreader/asio_stream.hpp:167:43:  [4] (shell) system:
  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.
                            [this](boost::system::error_code ec, std::size_t length) mutable {
data/snapcast-0.19.0/server/streamreader/asio_stream.hpp:208:80:  [4] (shell) system:
  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.
                                    read_timer_.async_wait([this](const boost::system::error_code& ec) {
data/snapcast-0.19.0/server/streamreader/tcp_stream.cpp:73:47:  [4] (shell) system:
  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.
        acceptor_->async_accept([this](boost::system::error_code ec, tcp::socket socket) {
data/snapcast-0.19.0/server/streamreader/tcp_stream.cpp:90:62:  [4] (shell) system:
  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.
        stream_->async_connect(endpoint, [this](const boost::system::error_code& ec) {
data/snapcast-0.19.0/server/streamreader/watchdog.cpp:61:43:  [4] (shell) system:
  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.
    timer_.async_wait([this](const boost::system::error_code& ec) {
data/snapcast-0.19.0/client/player/oboe_player.cpp:37:17:  [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.
    char* env = getenv("SAMPLE_RATE");
data/snapcast-0.19.0/client/player/oboe_player.cpp:40:11:  [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.
    env = getenv("FRAMES_PER_BUFFER");
data/snapcast-0.19.0/common/utils.hpp:188:14:  [3] (random) srand:
  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.
        std::srand(std::time(nullptr));
data/snapcast-0.19.0/server/config.cpp:49:14:  [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.
    else if (getenv("HOME") == nullptr)
data/snapcast-0.19.0/server/config.cpp:52:22:  [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.
        dir = string(getenv("HOME")) + "/.config/snapserver/";
data/snapcast-0.19.0/server/encoder/ogg_encoder.cpp:232:5:  [3] (random) srand:
  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.
    srand(time(nullptr));
data/snapcast-0.19.0/client/browseZeroConf/browse_avahi.cpp:79:13:  [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 a[AVAHI_ADDRESS_STR_MAX], *t;
data/snapcast-0.19.0/client/browseZeroConf/browse_bonjour.cpp:226:47:  [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 hostIP[NI_MAXHOST];
data/snapcast-0.19.0/client/browseZeroConf/browse_bonjour.cpp:227:47:  [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 hostService[NI_MAXSERV];
data/snapcast-0.19.0/client/decoder/flac_decoder.cpp:72: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(flacChunk->payload, chunk->payload, chunk->payloadSize);
data/snapcast-0.19.0/client/decoder/flac_decoder.cpp:132: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(buffer, flacHeader->payload, *bytes);
data/snapcast-0.19.0/client/decoder/flac_decoder.cpp:145: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(buffer, flacChunk->payload, *bytes);
data/snapcast-0.19.0/client/decoder/ogg_decoder.cpp:61: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(buffer, chunk->payload, size);
data/snapcast-0.19.0/client/decoder/ogg_decoder.cpp:166: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(buffer, chunk->payload, size);
data/snapcast-0.19.0/client/decoder/opus_decoder.cpp:77: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(chunk->payload, (char*)pcm_.data(), chunk->payloadSize);
data/snapcast-0.19.0/client/decoder/opus_decoder.cpp:97: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(&rate, chunk->payload + 4, sizeof(id_opus));
data/snapcast-0.19.0/client/player/coreaudio_player.cpp:79: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[1024];
data/snapcast-0.19.0/client/stream.cpp:177: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(resampled_chunk->payload, resample_buffer_.data(), resampled_chunk->payloadSize);
data/snapcast-0.19.0/client/stream.cpp:290:13:  [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(static_cast<char*>(outputBuffer) + pos * format_.frameSize(), read_buffer_.data() + (pos - n) * format_.frameSize(),
data/snapcast-0.19.0/client/stream.cpp:298:13:  [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(static_cast<char*>(outputBuffer) + (pos - n) * format_.frameSize(), read_buffer_.data() + pos * format_.frameSize(),
data/snapcast-0.19.0/common/aixlog.hpp:279: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 buffer[256];
data/snapcast-0.19.0/common/aixlog.hpp:286:13:  [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 ms_str[4];
data/snapcast-0.19.0/common/aixlog.hpp:702:13:  [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).
        ofs.open(filename.c_str(), std::ofstream::out | std::ofstream::trunc);
data/snapcast-0.19.0/common/daemon.cpp:58: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).
    pidFilehandle_ = open(pidfile_.c_str(), O_RDWR | O_CREAT, 0644);
data/snapcast-0.19.0/common/daemon.cpp:153: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 str[10];
data/snapcast-0.19.0/common/daemon.cpp:155:5:  [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(str, "%d\n", getpid());
data/snapcast-0.19.0/common/json.hpp:5687:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        std::memcpy(&result, vec.data(), sizeof(NumberType));
data/snapcast-0.19.0/common/json.hpp:6857:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        std::memcpy(vec.data(), &n, sizeof(NumberType));
data/snapcast-0.19.0/common/json.hpp:7142:10:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    std::memcpy(&target, &source, sizeof(Source));
data/snapcast-0.19.0/common/message/pcm_chunk.hpp:70:13:  [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*)outputBuffer, (char*)(payload) + format.frameSize() * idx_, format.frameSize() * result);
data/snapcast-0.19.0/common/message/wire_chunk.hpp:51: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(payload, wireChunk.payload, payloadSize);
data/snapcast-0.19.0/common/utils.hpp:68: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 buffer[1024];
data/snapcast-0.19.0/common/utils.hpp:83: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 cresult[PROP_VALUE_MAX + 1];
data/snapcast-0.19.0/common/utils.hpp:131: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 hostname[1024];
data/snapcast-0.19.0/common/utils.hpp:204: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[16384];
data/snapcast-0.19.0/common/utils.hpp:245:29:  [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 mac[19];
data/snapcast-0.19.0/common/utils.hpp:246:29:  [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(mac, "%02x:%02x:%02x:%02x:%02x:%02x", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4), *(ptr + 5));
data/snapcast-0.19.0/common/utils.hpp:292: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 mac[19];
data/snapcast-0.19.0/common/utils.hpp:294:5:  [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(mac, "%02x:%02x:%02x:%02x:%02x:%02x", (unsigned char)ifr.ifr_hwaddr.sa_data[0], (unsigned char)ifr.ifr_hwaddr.sa_data[1],
data/snapcast-0.19.0/common/utils.hpp:298:5:  [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(mac, "%02x:%02x:%02x:%02x:%02x:%02x", (unsigned char)ifr.ifr_ifru.ifru_addr.sa_data[0], (unsigned char)ifr.ifr_ifru.ifru_addr.sa_data[1],
data/snapcast-0.19.0/common/utils.hpp:318: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[64];
data/snapcast-0.19.0/server/config.cpp:68: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).
    if ((fd = open(filename_.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1)
data/snapcast-0.19.0/server/control_session_http.cpp:200: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).
    body.open(path.c_str(), beast::file_mode::scan, ec);
data/snapcast-0.19.0/server/encoder/flac_encoder.cpp:126: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(headerChunk_->payload + headerChunk_->payloadSize, buffer, bytes);
data/snapcast-0.19.0/server/encoder/flac_encoder.cpp:132: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(flacChunk_->payload + flacChunk_->payloadSize, buffer, bytes);
data/snapcast-0.19.0/server/encoder/ogg_encoder.cpp:131: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(oggChunk->payload + pos, og_.header, og_.header_len);
data/snapcast-0.19.0/server/encoder/ogg_encoder.cpp:133: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(oggChunk->payload + pos, og_.body, og_.body_len);
data/snapcast-0.19.0/server/encoder/ogg_encoder.cpp:264: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(headerChunk_->payload + pos, og_.header, og_.header_len);
data/snapcast-0.19.0/server/encoder/ogg_encoder.cpp:266: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(headerChunk_->payload + pos, og_.body, og_.body_len);
data/snapcast-0.19.0/server/encoder/opus_encoder.cpp:177: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(remainder_->payload + remainder_->payloadSize, chunk->payload, offset);
data/snapcast-0.19.0/server/encoder/opus_encoder.cpp: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(remainder_->payload + remainder_->payloadSize, chunk->payload + offset, chunk->payloadSize - offset);
data/snapcast-0.19.0/server/encoder/opus_encoder.cpp:233: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(opusChunk->payload, encoded_.data(), len);
data/snapcast-0.19.0/server/publishZeroConf/publish_bonjour.cpp:28:14:  [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.
    unsigned char b[2];
data/snapcast-0.19.0/server/streamreader/airplay_stream.cpp:218: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).
            int fd = open(pipePath_.c_str(), O_RDONLY | O_NONBLOCK);
data/snapcast-0.19.0/server/streamreader/base64.cpp:44:14:  [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.
    unsigned char char_array_3[3];
data/snapcast-0.19.0/server/streamreader/base64.cpp:45:14:  [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.
    unsigned char char_array_4[4];
data/snapcast-0.19.0/server/streamreader/base64.cpp:88:14:  [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.
    unsigned char char_array_4[4], char_array_3[3];
data/snapcast-0.19.0/server/streamreader/file_stream.cpp:54: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).
    int fd = open(uri_.path.c_str(), O_RDONLY | O_NONBLOCK);
data/snapcast-0.19.0/server/streamreader/pipe_stream.cpp:59: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).
    int fd = open(uri_.path.c_str(), O_RDONLY | O_NONBLOCK);
data/snapcast-0.19.0/server/streamreader/process_stream.cpp:70: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 buff[PATH_MAX];
data/snapcast-0.19.0/server/streamreader/process_stream.cpp:71: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 szTmp[32];
data/snapcast-0.19.0/server/streamreader/process_stream.cpp:72:5:  [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(szTmp, "/proc/%d/exe", getpid());
data/snapcast-0.19.0/client/controller.cpp:238:30:  [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.
                    chronos::usleep(100);
data/snapcast-0.19.0/client/stream.cpp:233:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while (read < frames)
data/snapcast-0.19.0/client/stream.cpp:235:71:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        read += chunk_->readFrames(static_cast<char*>(outputBuffer) + read * format_.frameSize(), frames - read);
data/snapcast-0.19.0/client/stream.cpp:235:108:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        read += chunk_->readFrames(static_cast<char*>(outputBuffer) + read * format_.frameSize(), frames - read);
data/snapcast-0.19.0/common/daemon.cpp:130:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(0);
data/snapcast-0.19.0/common/daemon.cpp:158:36:  [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 (write(pidFilehandle_, str, strlen(str)) != (int)strlen(str))
data/snapcast-0.19.0/common/daemon.cpp:158:57:  [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 (write(pidFilehandle_, str, strlen(str)) != (int)strlen(str))
data/snapcast-0.19.0/common/json.hpp:1777:83:  [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).
    input_adapter(CharT b) : input_adapter(reinterpret_cast<const char*>(b), std::strlen(reinterpret_cast<const char*>(b)))
data/snapcast-0.19.0/common/message/codec_header.hpp:45:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    void read(std::istream& stream) override
data/snapcast-0.19.0/common/message/json_message.hpp:41:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    void read(std::istream& stream) override
data/snapcast-0.19.0/common/message/message.hpp:130:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    virtual void read(std::istream& stream)
data/snapcast-0.19.0/common/message/message.hpp:146:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        read(is);
data/snapcast-0.19.0/common/message/message.hpp:159:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        read(is);
data/snapcast-0.19.0/common/message/message.hpp:247:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(reinterpret_cast<char*>(&val), sizeof(char));
data/snapcast-0.19.0/common/message/message.hpp:252:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(reinterpret_cast<char*>(&val), sizeof(uint16_t));
data/snapcast-0.19.0/common/message/message.hpp:258:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(reinterpret_cast<char*>(&val), sizeof(int16_t));
data/snapcast-0.19.0/common/message/message.hpp:264:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(reinterpret_cast<char*>(&val), sizeof(uint32_t));
data/snapcast-0.19.0/common/message/message.hpp:270:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(reinterpret_cast<char*>(&val), sizeof(int32_t));
data/snapcast-0.19.0/common/message/message.hpp:278:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(*payload, size);
data/snapcast-0.19.0/common/message/message.hpp:286:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        stream.read(&val[0], size);
data/snapcast-0.19.0/common/message/time.hpp:36:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    void read(std::istream& stream) override
data/snapcast-0.19.0/common/message/wire_chunk.hpp:59:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    void read(std::istream& stream) override
data/snapcast-0.19.0/common/popl.hpp:711:9:  [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(value) == 0)
data/snapcast-0.19.0/common/popl.hpp:809:32:  [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 ((value != nullptr) && (strlen(value) > 0))
data/snapcast-0.19.0/common/time_defs.hpp:130:13:  [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.
inline void usleep(const int32_t& microseconds)
data/snapcast-0.19.0/server/streamreader/pipe_stream.cpp:41:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(0);
data/snapcast-0.19.0/server/streamreader/posix_stream.cpp:94:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            int count = read(stream_->native_handle(), chunk_->payload + len, toRead - len);

ANALYSIS SUMMARY:

Hits = 116
Lines analyzed = 36582 in approximately 0.89 seconds (41024 lines/second)
Physical Source Lines of Code (SLOC) = 21421
Hits@level = [0]   6 [1]  27 [2]  56 [3]   6 [4]  24 [5]   3
Hits@level+ = [0+] 122 [1+] 116 [2+]  89 [3+]  33 [4+]  27 [5+]   3
Hits/KSLOC@level+ = [0+] 5.69535 [1+] 5.41525 [2+] 4.1548 [3+] 1.54054 [4+] 1.26045 [5+] 0.140049
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.