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/rtorrent-0.9.8/test/main.cc
Examining data/rtorrent-0.9.8/test/rpc/command_slot_test.cc
Examining data/rtorrent-0.9.8/test/rpc/command_slot_test.h
Examining data/rtorrent-0.9.8/test/rpc/object_storage_test.h
Examining data/rtorrent-0.9.8/test/rpc/command_test.cc
Examining data/rtorrent-0.9.8/test/rpc/command_map_test.h
Examining data/rtorrent-0.9.8/test/rpc/object_storage_test.cc
Examining data/rtorrent-0.9.8/test/rpc/command_test.h
Examining data/rtorrent-0.9.8/test/rpc/command_map_test.cc
Examining data/rtorrent-0.9.8/test/src/command_dynamic_test.h
Examining data/rtorrent-0.9.8/test/src/command_dynamic_test.cc
Examining data/rtorrent-0.9.8/rak/string_manip.h
Examining data/rtorrent-0.9.8/rak/algorithm.h
Examining data/rtorrent-0.9.8/rak/priority_queue_default.h
Examining data/rtorrent-0.9.8/rak/socket_address.h
Examining data/rtorrent-0.9.8/rak/path.h
Examining data/rtorrent-0.9.8/rak/unordered_vector.h
Examining data/rtorrent-0.9.8/rak/regex.h
Examining data/rtorrent-0.9.8/rak/priority_queue.h
Examining data/rtorrent-0.9.8/rak/error_number.h
Examining data/rtorrent-0.9.8/rak/fs_stat.h
Examining data/rtorrent-0.9.8/rak/functional.h
Examining data/rtorrent-0.9.8/rak/timer.h
Examining data/rtorrent-0.9.8/rak/address_info.h
Examining data/rtorrent-0.9.8/rak/file_stat.h
Examining data/rtorrent-0.9.8/rak/allocators.h
Examining data/rtorrent-0.9.8/rak/functional_fun.h
Examining data/rtorrent-0.9.8/rak/partial_queue.h
Examining data/rtorrent-0.9.8/src/main.cc
Examining data/rtorrent-0.9.8/src/signal_handler.h
Examining data/rtorrent-0.9.8/src/command_ip.cc
Examining data/rtorrent-0.9.8/src/ui/element_transfer_list.h
Examining data/rtorrent-0.9.8/src/ui/element_text.h
Examining data/rtorrent-0.9.8/src/ui/element_tracker_list.h
Examining data/rtorrent-0.9.8/src/ui/element_transfer_list.cc
Examining data/rtorrent-0.9.8/src/ui/root.cc
Examining data/rtorrent-0.9.8/src/ui/element_file_list.cc
Examining data/rtorrent-0.9.8/src/ui/element_peer_list.h
Examining data/rtorrent-0.9.8/src/ui/element_file_list.h
Examining data/rtorrent-0.9.8/src/ui/element_download_list.h
Examining data/rtorrent-0.9.8/src/ui/element_chunks_seen.cc
Examining data/rtorrent-0.9.8/src/ui/element_download_list.cc
Examining data/rtorrent-0.9.8/src/ui/element_chunks_seen.h
Examining data/rtorrent-0.9.8/src/ui/download.cc
Examining data/rtorrent-0.9.8/src/ui/download_list.cc
Examining data/rtorrent-0.9.8/src/ui/element_menu.h
Examining data/rtorrent-0.9.8/src/ui/element_tracker_list.cc
Examining data/rtorrent-0.9.8/src/ui/element_log_complete.h
Examining data/rtorrent-0.9.8/src/ui/download.h
Examining data/rtorrent-0.9.8/src/ui/element_text.cc
Examining data/rtorrent-0.9.8/src/ui/element_log_complete.cc
Examining data/rtorrent-0.9.8/src/ui/download_list.h
Examining data/rtorrent-0.9.8/src/ui/element_peer_list.cc
Examining data/rtorrent-0.9.8/src/ui/element_menu.cc
Examining data/rtorrent-0.9.8/src/ui/root.h
Examining data/rtorrent-0.9.8/src/ui/element_string_list.h
Examining data/rtorrent-0.9.8/src/ui/element_string_list.cc
Examining data/rtorrent-0.9.8/src/ui/element_base.h
Examining data/rtorrent-0.9.8/src/ui/element_base.cc
Examining data/rtorrent-0.9.8/src/option_parser.cc
Examining data/rtorrent-0.9.8/src/control.h
Examining data/rtorrent-0.9.8/src/command_download.cc
Examining data/rtorrent-0.9.8/src/command_helpers.cc
Examining data/rtorrent-0.9.8/src/core/curl_stack.h
Examining data/rtorrent-0.9.8/src/core/curl_socket.h
Examining data/rtorrent-0.9.8/src/core/download_factory.cc
Examining data/rtorrent-0.9.8/src/core/curl_get.cc
Examining data/rtorrent-0.9.8/src/core/manager.cc
Examining data/rtorrent-0.9.8/src/core/view.cc
Examining data/rtorrent-0.9.8/src/core/manager.h
Examining data/rtorrent-0.9.8/src/core/range_map.h
Examining data/rtorrent-0.9.8/src/core/view_manager.cc
Examining data/rtorrent-0.9.8/src/core/view.h
Examining data/rtorrent-0.9.8/src/core/curl_get.h
Examining data/rtorrent-0.9.8/src/core/download.cc
Examining data/rtorrent-0.9.8/src/core/download_list.cc
Examining data/rtorrent-0.9.8/src/core/http_queue.h
Examining data/rtorrent-0.9.8/src/core/download_slot_map.h
Examining data/rtorrent-0.9.8/src/core/download_store.h
Examining data/rtorrent-0.9.8/src/core/download.h
Examining data/rtorrent-0.9.8/src/core/download_list.h
Examining data/rtorrent-0.9.8/src/core/curl_stack.cc
Examining data/rtorrent-0.9.8/src/core/poll_manager.cc
Examining data/rtorrent-0.9.8/src/core/http_queue.cc
Examining data/rtorrent-0.9.8/src/core/download_store.cc
Examining data/rtorrent-0.9.8/src/core/dht_manager.cc
Examining data/rtorrent-0.9.8/src/core/poll_manager.h
Examining data/rtorrent-0.9.8/src/core/dht_manager.h
Examining data/rtorrent-0.9.8/src/core/download_factory.h
Examining data/rtorrent-0.9.8/src/core/view_manager.h
Examining data/rtorrent-0.9.8/src/core/curl_socket.cc
Examining data/rtorrent-0.9.8/src/input/path_input.cc
Examining data/rtorrent-0.9.8/src/input/input_event.h
Examining data/rtorrent-0.9.8/src/input/text_input.h
Examining data/rtorrent-0.9.8/src/input/manager.cc
Examining data/rtorrent-0.9.8/src/input/manager.h
Examining data/rtorrent-0.9.8/src/input/path_input.h
Examining data/rtorrent-0.9.8/src/input/bindings.cc
Examining data/rtorrent-0.9.8/src/input/bindings.h
Examining data/rtorrent-0.9.8/src/input/text_input.cc
Examining data/rtorrent-0.9.8/src/input/input_event.cc
Examining data/rtorrent-0.9.8/src/command_file.cc
Examining data/rtorrent-0.9.8/src/command_dynamic.cc
Examining data/rtorrent-0.9.8/src/command_peer.cc
Examining data/rtorrent-0.9.8/src/signal_handler.cc
Examining data/rtorrent-0.9.8/src/option_parser.h
Examining data/rtorrent-0.9.8/src/command_local.cc
Examining data/rtorrent-0.9.8/src/utils/directory.cc
Examining data/rtorrent-0.9.8/src/utils/list_focus.h
Examining data/rtorrent-0.9.8/src/utils/lockfile.h
Examining data/rtorrent-0.9.8/src/utils/file_status_cache.cc
Examining data/rtorrent-0.9.8/src/utils/file_status_cache.h
Examining data/rtorrent-0.9.8/src/utils/directory.h
Examining data/rtorrent-0.9.8/src/utils/socket_fd.h
Examining data/rtorrent-0.9.8/src/utils/socket_fd.cc
Examining data/rtorrent-0.9.8/src/utils/lockfile.cc
Examining data/rtorrent-0.9.8/src/globals.h
Examining data/rtorrent-0.9.8/src/command_network.cc
Examining data/rtorrent-0.9.8/src/command_tracker.cc
Examining data/rtorrent-0.9.8/src/control.cc
Examining data/rtorrent-0.9.8/src/globals.cc
Examining data/rtorrent-0.9.8/src/command_helpers.h
Examining data/rtorrent-0.9.8/src/command_throttle.cc
Examining data/rtorrent-0.9.8/src/thread_base.cc
Examining data/rtorrent-0.9.8/src/thread_base.h
Examining data/rtorrent-0.9.8/src/thread_worker.cc
Examining data/rtorrent-0.9.8/src/display/window_string_list.cc
Examining data/rtorrent-0.9.8/src/display/window_log.h
Examining data/rtorrent-0.9.8/src/display/utils.h
Examining data/rtorrent-0.9.8/src/display/window_download_list.h
Examining data/rtorrent-0.9.8/src/display/text_element_string.cc
Examining data/rtorrent-0.9.8/src/display/window_download_transfer_list.h
Examining data/rtorrent-0.9.8/src/display/window_title.cc
Examining data/rtorrent-0.9.8/src/display/canvas.cc
Examining data/rtorrent-0.9.8/src/display/window_download_list.cc
Examining data/rtorrent-0.9.8/src/display/window_peer_list.cc
Examining data/rtorrent-0.9.8/src/display/manager.cc
Examining data/rtorrent-0.9.8/src/display/utils.cc
Examining data/rtorrent-0.9.8/src/display/window_input.cc
Examining data/rtorrent-0.9.8/src/display/manager.h
Examining data/rtorrent-0.9.8/src/display/window_log_complete.h
Examining data/rtorrent-0.9.8/src/display/frame.h
Examining data/rtorrent-0.9.8/src/display/text_element_value.h
Examining data/rtorrent-0.9.8/src/display/window_download_chunks_seen.cc
Examining data/rtorrent-0.9.8/src/display/window_download_statusbar.cc
Examining data/rtorrent-0.9.8/src/display/window_text.h
Examining data/rtorrent-0.9.8/src/display/window.h
Examining data/rtorrent-0.9.8/src/display/text_element_string.h
Examining data/rtorrent-0.9.8/src/display/attributes.h
Examining data/rtorrent-0.9.8/src/display/text_element_list.h
Examining data/rtorrent-0.9.8/src/display/window_http_queue.cc
Examining data/rtorrent-0.9.8/src/display/frame.cc
Examining data/rtorrent-0.9.8/src/display/window_statusbar.h
Examining data/rtorrent-0.9.8/src/display/window_file_list.cc
Examining data/rtorrent-0.9.8/src/display/window_download_chunks_seen.h
Examining data/rtorrent-0.9.8/src/display/text_element_value.cc
Examining data/rtorrent-0.9.8/src/display/window_input.h
Examining data/rtorrent-0.9.8/src/display/window_log.cc
Examining data/rtorrent-0.9.8/src/display/window_statusbar.cc
Examining data/rtorrent-0.9.8/src/display/window_download_transfer_list.cc
Examining data/rtorrent-0.9.8/src/display/window_download_statusbar.h
Examining data/rtorrent-0.9.8/src/display/window_tracker_list.cc
Examining data/rtorrent-0.9.8/src/display/window_file_list.h
Examining data/rtorrent-0.9.8/src/display/window_peer_list.h
Examining data/rtorrent-0.9.8/src/display/window_string_list.h
Examining data/rtorrent-0.9.8/src/display/window_title.h
Examining data/rtorrent-0.9.8/src/display/window_log_complete.cc
Examining data/rtorrent-0.9.8/src/display/window_tracker_list.h
Examining data/rtorrent-0.9.8/src/display/window_http_queue.h
Examining data/rtorrent-0.9.8/src/display/canvas.h
Examining data/rtorrent-0.9.8/src/display/text_element_list.cc
Examining data/rtorrent-0.9.8/src/display/text_element.h
Examining data/rtorrent-0.9.8/src/display/window.cc
Examining data/rtorrent-0.9.8/src/display/window_text.cc
Examining data/rtorrent-0.9.8/src/command_logging.cc
Examining data/rtorrent-0.9.8/src/rpc/parse_commands.cc
Examining data/rtorrent-0.9.8/src/rpc/parse.cc
Examining data/rtorrent-0.9.8/src/rpc/exec_file.cc
Examining data/rtorrent-0.9.8/src/rpc/command_impl.h
Examining data/rtorrent-0.9.8/src/rpc/command_map.h
Examining data/rtorrent-0.9.8/src/rpc/parse.h
Examining data/rtorrent-0.9.8/src/rpc/scgi.h
Examining data/rtorrent-0.9.8/src/rpc/command_scheduler_item.h
Examining data/rtorrent-0.9.8/src/rpc/xmlrpc.h
Examining data/rtorrent-0.9.8/src/rpc/ip_table_list.h
Examining data/rtorrent-0.9.8/src/rpc/parse_commands.h
Examining data/rtorrent-0.9.8/src/rpc/xmlrpc.cc
Examining data/rtorrent-0.9.8/src/rpc/scgi_task.h
Examining data/rtorrent-0.9.8/src/rpc/scgi_task.cc
Examining data/rtorrent-0.9.8/src/rpc/command_map.cc
Examining data/rtorrent-0.9.8/src/rpc/scgi.cc
Examining data/rtorrent-0.9.8/src/rpc/command_scheduler_item.cc
Examining data/rtorrent-0.9.8/src/rpc/exec_file.h
Examining data/rtorrent-0.9.8/src/rpc/command.h
Examining data/rtorrent-0.9.8/src/rpc/object_storage.cc
Examining data/rtorrent-0.9.8/src/rpc/command_scheduler.cc
Examining data/rtorrent-0.9.8/src/rpc/fixed_key.h
Examining data/rtorrent-0.9.8/src/rpc/command_scheduler.h
Examining data/rtorrent-0.9.8/src/rpc/command.cc
Examining data/rtorrent-0.9.8/src/rpc/object_storage.h
Examining data/rtorrent-0.9.8/src/command_groups.cc
Examining data/rtorrent-0.9.8/src/command_scheduler.cc
Examining data/rtorrent-0.9.8/src/command_events.cc
Examining data/rtorrent-0.9.8/src/command_ui.cc
Examining data/rtorrent-0.9.8/src/thread_worker.h

FINAL RESULTS:

data/rtorrent-0.9.8/src/command_events.cc:69:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(buffer, "group2.%s.view", groupName.c_str());
data/rtorrent-0.9.8/src/command_events.cc:76:32:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  char* bufferStart = buffer + sprintf(buffer, "group2.%s.ratio.", groupName.c_str());
data/rtorrent-0.9.8/src/command_events.cc:106:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(buffer, "group.%s.ratio.command", groupName.c_str());
data/rtorrent-0.9.8/src/command_local.cc:195:7:  [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(output, (const char*)" %s" + !(flags & file_print_use_space), first->as_string().c_str());
data/rtorrent-0.9.8/src/command_local.cc:198:7:  [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(output, (const char*)" %lli" + !(flags & file_print_use_space), first->as_value());
data/rtorrent-0.9.8/src/display/utils.h:92:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, 0);
data/rtorrent-0.9.8/src/display/utils.h:106:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, arg1);
data/rtorrent-0.9.8/src/display/utils.h:120:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, arg1, arg2);
data/rtorrent-0.9.8/src/display/utils.h:134:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, arg1, arg2, arg3);
data/rtorrent-0.9.8/src/display/utils.h:148:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, arg1, arg2, arg3, arg4);
data/rtorrent-0.9.8/src/display/utils.h:162:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, arg1, arg2, arg3, arg4, arg5);
data/rtorrent-0.9.8/src/display/utils.h:176:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
  int s = snprintf(first, last - first, format, arg1, arg2, arg3, arg4, arg5, arg6);
data/rtorrent-0.9.8/src/main.cc:460: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.
          access((std::string(config_dir) + "/rtorrent/rtorrent.rc").c_str(), F_OK) != -1) {
data/rtorrent-0.9.8/src/main.cc:462:38:  [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.
      } else if (home_dir != NULL && access((std::string(home_dir) + "/.config/rtorrent/rtorrent.rc").c_str(), F_OK) != -1) {
data/rtorrent-0.9.8/src/rpc/exec_file.cc:135:18:  [4] (shell) execvp:
  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.
    int result = execvp(file, argv);
data/rtorrent-0.9.8/rak/path.h:53: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.
  char* home = std::getenv("HOME");
data/rtorrent-0.9.8/rak/path.h:89:23:  [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* home = std::getenv("HOME");
data/rtorrent-0.9.8/src/command_local.cc:86:15:  [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* val = getenv(arg.c_str());
data/rtorrent-0.9.8/src/core/download_factory.cc:414:39:  [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.
    download->tracker_list()->set_key(random() % (std::numeric_limits<uint32_t>::max() - 1) + 1);
data/rtorrent-0.9.8/src/core/manager.cc:207:32:  [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.
    int boundary = portFirst + random() % (portLast - portFirst + 1);
data/rtorrent-0.9.8/src/core/poll_manager.cc:55:27:  [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* poll_name = getenv("RTORRENT_POLL");
data/rtorrent-0.9.8/src/main.cc:196:5:  [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(random_seed);
data/rtorrent-0.9.8/src/main.cc:456: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.
      char* config_dir = std::getenv("XDG_CONFIG_HOME");
data/rtorrent-0.9.8/src/main.cc:457:29:  [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* home_dir = std::getenv("HOME");
data/rtorrent-0.9.8/src/option_parser.cc:78:15:  [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 ((c = getopt(argc, argv, optString.c_str())) != -1)
data/rtorrent-0.9.8/rak/socket_address.h:354:8:  [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(this, &src, length);
data/rtorrent-0.9.8/rak/socket_address.h:391: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[INET_ADDRSTRLEN];
data/rtorrent-0.9.8/rak/socket_address.h:441: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[INET6_ADDRSTRLEN];
data/rtorrent-0.9.8/src/command_download.cc:341: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 host[1024];
data/rtorrent-0.9.8/src/command_events.cc:68: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[32 + groupName.size()];
data/rtorrent-0.9.8/src/command_events.cc:81:8:  [2] (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). Risk is low because the source is a constant string.
  std::strcpy(bufferStart, "min");
data/rtorrent-0.9.8/src/command_events.cc:83:8:  [2] (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). Risk is low because the source is a constant string.
  std::strcpy(bufferStart, "max");
data/rtorrent-0.9.8/src/command_events.cc:85:8:  [2] (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). Risk is low because the source is a constant string.
  std::strcpy(bufferStart, "upload");
data/rtorrent-0.9.8/src/command_events.cc:359:37:  [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 (!control->directory_events()->open())
data/rtorrent-0.9.8/src/command_helpers.h:197:46:  [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.
create_new_key(const std::string& key, const char postfix[postfix_size]) {
data/rtorrent-0.9.8/src/command_helpers.h:199:8:  [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(buffer, key.c_str(), key.size() + 1);
data/rtorrent-0.9.8/src/command_helpers.h:200:8:  [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(buffer + key.size(), postfix, postfix_size);
data/rtorrent-0.9.8/src/command_helpers.h:207:8:  [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(buffer, key.c_str(), key.size() + 1);
data/rtorrent-0.9.8/src/command_ip.cc:160: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 address_copy[4096];
data/rtorrent-0.9.8/src/command_ip.cc:162: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 address_start_str[20];
data/rtorrent-0.9.8/src/command_ip.cc:199: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 address_end_str[20];
data/rtorrent-0.9.8/src/command_ip.cc:223: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 mask_bits_str[20];
data/rtorrent-0.9.8/src/command_ip.cc:281: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 start_str[INET_ADDRSTRLEN];
data/rtorrent-0.9.8/src/command_ip.cc:282: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 end_str[INET_ADDRSTRLEN];
data/rtorrent-0.9.8/src/command_ip.cc:337: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[4096];
data/rtorrent-0.9.8/src/command_ip.cc:376: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[64];
data/rtorrent-0.9.8/src/command_ip.cc:381: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 start_str[INET_ADDRSTRLEN];
data/rtorrent-0.9.8/src/command_ip.cc:382: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 end_str[INET_ADDRSTRLEN];
data/rtorrent-0.9.8/src/command_local.cc:92: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[1024];
data/rtorrent-0.9.8/src/command_local.cc:219:18:  [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* output = fopen(args.front().as_string().c_str(), "a");
data/rtorrent-0.9.8/src/command_logging.cc:41: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[32];
data/rtorrent-0.9.8/src/command_logging.cc:86:17:  [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 logFd = open(rak::path_expand(arg).c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644);
data/rtorrent-0.9.8/src/command_logging.cc:117: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* log_file = fopen(str.c_str(), "w");
data/rtorrent-0.9.8/src/command_network.cc:161: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 address[1024];
data/rtorrent-0.9.8/src/command_peer.cc:87: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[128];
data/rtorrent-0.9.8/src/command_throttle.cc:58: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 host[1024];
data/rtorrent-0.9.8/src/command_tracker.cc:83: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 host[1024];
data/rtorrent-0.9.8/src/command_ui.cc:139: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[1024];
data/rtorrent-0.9.8/src/command_ui.cc:434: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[11];
data/rtorrent-0.9.8/src/command_ui.cc:448: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[48];
data/rtorrent-0.9.8/src/command_ui.cc:456: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[32];
data/rtorrent-0.9.8/src/command_ui.cc:464: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[32];
data/rtorrent-0.9.8/src/command_ui.cc:472: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[48];
data/rtorrent-0.9.8/src/command_ui.cc:495: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[32];
data/rtorrent-0.9.8/src/core/curl_socket.cc:73:37:  [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).
    torrent::main_thread()->poll()->open(socket);
data/rtorrent-0.9.8/src/core/dht_manager.cc:261: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[128];
data/rtorrent-0.9.8/src/core/dht_manager.cc:271: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[256];
data/rtorrent-0.9.8/src/core/download_list.cc:233: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).
DownloadList::open(Download* download) {
data/rtorrent-0.9.8/src/core/download_list.cc:260:25:  [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).
  download->download()->open(openFlags);
data/rtorrent-0.9.8/src/core/download_list.h:99: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).
  bool                open(Download* d);
data/rtorrent-0.9.8/src/core/download_store.cc:117: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).
  output.open(filename.c_str(), std::ios::in);
data/rtorrent-0.9.8/src/core/manager.cc:291: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[addr.length() + 1];
data/rtorrent-0.9.8/src/display/text_element_string.cc:55: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[last - first];
data/rtorrent-0.9.8/src/display/text_element_string.cc:61: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[last - first];
data/rtorrent-0.9.8/src/display/text_element_string.cc:79:8:  [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(first, m_string.c_str(), length);
data/rtorrent-0.9.8/src/display/text_element_string.cc:88:8:  [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(first, m_string, length);
data/rtorrent-0.9.8/src/display/text_element_string.cc:117:12:  [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(first, str.c_str(), length);
data/rtorrent-0.9.8/src/display/text_element_string.h:126: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(first, result_buffer(&result), length);
data/rtorrent-0.9.8/src/display/utils.cc:202: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 status[128];
data/rtorrent-0.9.8/src/display/window_download_list.cc:124: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[m_canvas->width() + 1];
data/rtorrent-0.9.8/src/display/window_download_statusbar.cc: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 buffer[m_canvas->width()];
data/rtorrent-0.9.8/src/display/window_file_list.cc:65:3:  [2] (buffer) wchar_t:
  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.
  wchar_t result[width + 1];
data/rtorrent-0.9.8/src/display/window_log.cc:79: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[16];
data/rtorrent-0.9.8/src/display/window_log_complete.cc:72: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[16];
data/rtorrent-0.9.8/src/display/window_peer_list.cc:167: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[128];
data/rtorrent-0.9.8/src/display/window_statusbar.cc:56: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[m_canvas->width() + 1];
data/rtorrent-0.9.8/src/display/window_text.cc:97: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[m_canvas->width() + 1];
data/rtorrent-0.9.8/src/display/window_text.cc:112: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[m_canvas->width() + 1];
data/rtorrent-0.9.8/src/input/input_event.cc:47:6:  [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).
  p->open(this);
data/rtorrent-0.9.8/src/option_parser.cc:89: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 options[3] = { '-', flag, '\0' };
data/rtorrent-0.9.8/src/rpc/command.h:160: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[sizeof(torrent::Object) * max_arguments];
data/rtorrent-0.9.8/src/rpc/command.h:216: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 t_pod[sizeof(base_function)];
data/rtorrent-0.9.8/src/rpc/exec_file.cc:109:19:  [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 devNull = open("/dev/null", O_RDWR);
data/rtorrent-0.9.8/src/rpc/exec_file.cc:148: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[4096];
data/rtorrent-0.9.8/src/rpc/exec_file.cc:195: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   valueBuffer[buffer_size];
data/rtorrent-0.9.8/src/rpc/fixed_key.h:58:69:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  fixed_key_type(const fixed_key_type& k) : m_size(k.m_size) { std::memcpy(m_data, k.m_data, k.m_size + 1); }
data/rtorrent-0.9.8/src/rpc/fixed_key.h:90: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        m_data[max_size];
data/rtorrent-0.9.8/src/rpc/object_storage.h:194:8:  [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(m_data, src_data, m_size);
data/rtorrent-0.9.8/src/rpc/object_storage.h:218:8:  [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(m_data, src_data, m_size + 1);
data/rtorrent-0.9.8/src/rpc/parse.cc:276: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[64];
data/rtorrent-0.9.8/src/rpc/parse.cc:410: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[str.size() + 1];
data/rtorrent-0.9.8/src/rpc/parse.cc:411: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(buffer, str.data(), str.size());
data/rtorrent-0.9.8/src/rpc/parse.cc:444:12:  [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(first, str.c_str(), n);
data/rtorrent-0.9.8/src/rpc/parse.cc:493: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[64];
data/rtorrent-0.9.8/src/rpc/parse_commands.cc:139: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 key[128];
data/rtorrent-0.9.8/src/rpc/parse_commands.cc:192: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[4096];
data/rtorrent-0.9.8/src/rpc/scgi.cc:80:3:  [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).
  open(sa, length);
data/rtorrent-0.9.8/src/rpc/scgi.cc:88: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[sizeof(sockaddr_un) + filename.size()];
data/rtorrent-0.9.8/src/rpc/scgi.cc:97:8:  [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(sa->sun_path, filename.c_str(), filename.size() + 1);
data/rtorrent-0.9.8/src/rpc/scgi.cc:102:3:  [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).
  open(sa, offsetof(struct sockaddr_un, sun_path) + filename.size() + 1);
data/rtorrent-0.9.8/src/rpc/scgi.cc:107:7:  [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).
SCgi::open(void* sa, unsigned int length) {
data/rtorrent-0.9.8/src/rpc/scgi.cc:127:26:  [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).
  worker_thread->poll()->open(this);
data/rtorrent-0.9.8/src/rpc/scgi.cc:153:11:  [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).
    task->open(this, fd.get_fd());
data/rtorrent-0.9.8/src/rpc/scgi.h:85: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).
  void                open(void* sa, unsigned int length);
data/rtorrent-0.9.8/src/rpc/scgi_task.cc:67:8:  [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(tmp, buffer, bufferSize);
data/rtorrent-0.9.8/src/rpc/scgi_task.cc:73:11:  [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).
SCgiTask::open(SCgi* parent, int fd) {
data/rtorrent-0.9.8/src/rpc/scgi_task.cc:80:26:  [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).
  worker_thread->poll()->open(this);
data/rtorrent-0.9.8/src/rpc/scgi_task.cc:234:20:  [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.
  int headerSize = sprintf(m_buffer, "Status: 200 OK\r\nContent-Type: text/xml\r\nContent-Length: %i\r\n\r\n", length);
data/rtorrent-0.9.8/src/rpc/scgi_task.cc:239:8:  [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(m_buffer + headerSize, buffer, length);
data/rtorrent-0.9.8/src/rpc/scgi_task.h:61: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).
  void                open(SCgi* parent, int fd);
data/rtorrent-0.9.8/src/rpc/xmlrpc.cc:401: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 buffer[str.size() + 1];
data/rtorrent-0.9.8/src/thread_worker.cc:125: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).
  scgi()->set_log_fd(open(rak::path_expand(m_xmlrpcLog).c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644));
data/rtorrent-0.9.8/src/ui/root.cc:417:27:  [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).
          int type = std::atoi(line.substr(0, delim_pos).c_str());
data/rtorrent-0.9.8/src/utils/lockfile.cc:71: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[256];
data/rtorrent-0.9.8/src/utils/lockfile.cc:92: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(m_path.c_str(), O_RDWR | O_CREAT | O_EXCL, 0444);
data/rtorrent-0.9.8/src/utils/lockfile.cc:97: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[256];
data/rtorrent-0.9.8/src/utils/lockfile.cc:123: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(m_path.c_str(), O_RDONLY);
data/rtorrent-0.9.8/src/utils/lockfile.cc:128: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 first[256];
data/rtorrent-0.9.8/test/rpc/object_storage_test.cc:41: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 raw_3[8] = "test_3\x1";
data/rtorrent-0.9.8/rak/functional.h:106:1:  [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.
equal(Type t, Ftor f) {
data/rtorrent-0.9.8/src/command_groups.cc:141:76:  [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.
                                                                      rak::equal(arg.as_string(), std::mem_fun(&torrent::choke_group::name)));
data/rtorrent-0.9.8/src/command_groups.cc:194:25:  [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.
                   rak::equal(arg, std::mem_fun(&torrent::choke_group::name))) != cg_list_hack.end())
data/rtorrent-0.9.8/src/command_groups.cc:209:65:  [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.
    std::find_if(cg_list_hack.begin(), cg_list_hack.end(), rak::equal(arg, std::mem_fun(&torrent::choke_group::name)));
data/rtorrent-0.9.8/src/command_local.cc:267:67:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
  CMD2_ANY_VALUE_V ("system.umask.set",                std::bind(&umask, std::placeholders::_2));
data/rtorrent-0.9.8/src/core/curl_stack.cc:136:54:  [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.
    iterator itr = std::find_if(begin(), end(), rak::equal(msg->easy_handle, std::mem_fun(&CurlGet::handle)));
data/rtorrent-0.9.8/src/core/curl_stack.cc:158:52:  [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.
  iterator itr = std::find_if(begin(), end(), rak::equal(handle, std::mem_fun(&CurlGet::handle)));
data/rtorrent-0.9.8/src/core/download_list.cc:102:44:  [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::find_if(begin(), end(), rak::equal(hash, rak::on(std::mem_fun(&Download::info), std::mem_fun(&torrent::DownloadInfo::hash))));
data/rtorrent-0.9.8/src/core/download_list.cc:112:44:  [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::find_if(begin(), end(), rak::equal(key, rak::on(std::mem_fun(&Download::info), std::mem_fun(&torrent::DownloadInfo::hash))));
data/rtorrent-0.9.8/src/core/manager.cc:84:43:  [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).
  m_log_important->lock_and_push_log(msg, strlen(msg), 0);
data/rtorrent-0.9.8/src/core/manager.cc:85:42:  [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).
  m_log_complete->lock_and_push_log(msg, strlen(msg), 0);
data/rtorrent-0.9.8/src/core/view_manager.cc:79:44:  [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::find_if(begin(), end(), rak::equal(name, std::mem_fun(&View::name)));
data/rtorrent-0.9.8/src/core/view_manager.cc:84:52:  [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.
  iterator itr = std::find_if(begin(), end(), rak::equal(name, std::mem_fun(&View::name)));
data/rtorrent-0.9.8/src/display/text_element_string.h:91:118:  [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).
  TextElementCString(const char* s, int flags = flag_normal, int attributes = Attributes::a_invalid) : m_length(std::strlen(s)), m_string(s) {
data/rtorrent-0.9.8/src/display/text_element_string.h:138:41:  [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).
      return std::min<extent_type>(std::strlen(*result), m_length);
data/rtorrent-0.9.8/src/display/text_element_string.h:175:33:  [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).
    m_commandEnd(command + std::strlen(command)) {}
data/rtorrent-0.9.8/src/display/window_http_queue.cc:148:87:  [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.
  Container::iterator itr = std::find_if(m_container.begin(), m_container.end(), rak::equal(h, std::mem_fun_ref(&Node::get_http)));
data/rtorrent-0.9.8/src/rpc/command_scheduler.cc:58:44:  [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::find_if(begin(), end(), rak::equal(key, std::mem_fun(&CommandSchedulerItem::key)));
data/rtorrent-0.9.8/src/rpc/exec_file.cc:75:42:  [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).
      result = write(m_logFd, *itr, std::strlen(*itr));
data/rtorrent-0.9.8/src/rpc/exec_file.cc:152:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      length = read(pipeFd[0], buffer, sizeof(buffer));
data/rtorrent-0.9.8/src/rpc/object_storage.cc:230:54:  [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.
                                                rak::equal(key, rak::mem_ptr(&value_type::first)));
data/rtorrent-0.9.8/src/rpc/object_storage.cc:250:27:  [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.
                     rak::equal(key, rak::mem_ptr(&value_type::first))) == r_itr->second.end())
data/rtorrent-0.9.8/src/rpc/object_storage.h:115:119:  [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).
  iterator insert_c_str(const char* key, const torrent::Object& object, unsigned int flags) { return insert(key, std::strlen(key), object, flags); }
data/rtorrent-0.9.8/src/rpc/object_storage.h:130:97:  [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).
  const torrent::Object& get_c_str(const char* str)  { return get(torrent::raw_string(str, std::strlen(str))); }
data/rtorrent-0.9.8/src/rpc/object_storage.h:223:27:  [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).
  return insert(key, std::strlen(key), object, flags);
data/rtorrent-0.9.8/src/rpc/parse.cc:147:64:  [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 (strcasecmp(src, "no") == 0) { *value = 0; return src + strlen("no"); }
data/rtorrent-0.9.8/src/rpc/parse.cc:148: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).
    if (strcasecmp(src, "yes") == 0) { *value = 1; return src + strlen("yes"); }
data/rtorrent-0.9.8/src/rpc/parse.cc:149:66:  [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 (strcasecmp(src, "true") == 0) { *value = 1; return src + strlen("true"); }
data/rtorrent-0.9.8/src/rpc/parse.cc:150:67:  [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 (strcasecmp(src, "false") == 0) { *value = 0; return src + strlen("false"); }
data/rtorrent-0.9.8/src/rpc/parse_commands.h:67:137:  [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).
inline torrent::Object parse_command_single(target_type target, const char* first)   { return parse_command(target, first, first + std::strlen(first)).first; }
data/rtorrent-0.9.8/src/rpc/parse_commands.h:68:146:  [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).
inline torrent::Object parse_command_multiple(target_type target, const char* first) { return parse_command_multiple(target, first, first + std::strlen(first)); }
data/rtorrent-0.9.8/src/rpc/xmlrpc.cc:149: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).
    if (std::strlen(str) == 0) {
data/rtorrent-0.9.8/src/rpc/xmlrpc.cc:154: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).
    } else if (std::strlen(str) < 40) {
data/rtorrent-0.9.8/src/rpc/xmlrpc.cc:166: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).
    if (std::strlen(str) == 40) {
data/rtorrent-0.9.8/src/rpc/xmlrpc.cc:171: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).
    if (std::strlen(str) < 42 || str[40] != ':') {
data/rtorrent-0.9.8/src/thread_base.cc:69:76:  [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.
  void     lock()   { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); }
data/rtorrent-0.9.8/src/ui/element_download_list.cc:151:66:  [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).
      rpc::parse_command_multiple(rpc::make_target(), cmd, cmd + strlen(cmd));
data/rtorrent-0.9.8/src/ui/element_download_list.cc:153:82:  [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).
      rpc::parse_command_multiple(rpc::make_target(*m_view->focus()), cmd, cmd + strlen(cmd));
data/rtorrent-0.9.8/src/utils/lockfile.cc:101:27:  [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).
    ::snprintf(buf + std::strlen(buf), 255, ":+%i\n", ::getpid());
data/rtorrent-0.9.8/src/utils/lockfile.cc:102:49:  [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).
    int __UNUSED result = ::write(fd, buf, std::strlen(buf));
data/rtorrent-0.9.8/src/utils/lockfile.cc:129:42:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  char* last = first + std::max<ssize_t>(read(fd, first, 255), 0);

ANALYSIS SUMMARY:

Hits = 170
Lines analyzed = 34546 in approximately 0.81 seconds (42669 lines/second)
Physical Source Lines of Code (SLOC) = 19396
Hits@level = [0]  47 [1]  41 [2] 104 [3]  10 [4]  15 [5]   0
Hits@level+ = [0+] 217 [1+] 170 [2+] 129 [3+]  25 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 11.1879 [1+] 8.76469 [2+] 6.65086 [3+] 1.28893 [4+] 0.773355 [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.