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/kakoune-2020.01.16/src/alias_registry.cc
Examining data/kakoune-2020.01.16/src/assert.cc
Examining data/kakoune-2020.01.16/src/backtrace.cc
Examining data/kakoune-2020.01.16/src/buffer.cc
Examining data/kakoune-2020.01.16/src/buffer_manager.cc
Examining data/kakoune-2020.01.16/src/buffer_utils.cc
Examining data/kakoune-2020.01.16/src/changes.cc
Examining data/kakoune-2020.01.16/src/client.cc
Examining data/kakoune-2020.01.16/src/client_manager.cc
Examining data/kakoune-2020.01.16/src/color.cc
Examining data/kakoune-2020.01.16/src/command_manager.cc
Examining data/kakoune-2020.01.16/src/commands.cc
Examining data/kakoune-2020.01.16/src/completion.cc
Examining data/kakoune-2020.01.16/src/context.cc
Examining data/kakoune-2020.01.16/src/display_buffer.cc
Examining data/kakoune-2020.01.16/src/env_vars.cc
Examining data/kakoune-2020.01.16/src/exception.cc
Examining data/kakoune-2020.01.16/src/face_registry.cc
Examining data/kakoune-2020.01.16/src/hash.cc
Examining data/kakoune-2020.01.16/src/hash_map.cc
Examining data/kakoune-2020.01.16/src/highlighter.cc
Examining data/kakoune-2020.01.16/src/highlighter_group.cc
Examining data/kakoune-2020.01.16/src/highlighters.cc
Examining data/kakoune-2020.01.16/src/input_handler.cc
Examining data/kakoune-2020.01.16/src/json_ui.cc
Examining data/kakoune-2020.01.16/src/keymap_manager.cc
Examining data/kakoune-2020.01.16/src/keys.cc
Examining data/kakoune-2020.01.16/src/line_modification.cc
Examining data/kakoune-2020.01.16/src/main.cc
Examining data/kakoune-2020.01.16/src/memory.cc
Examining data/kakoune-2020.01.16/src/ncurses_ui.cc
Examining data/kakoune-2020.01.16/src/option_types.cc
Examining data/kakoune-2020.01.16/src/parameters_parser.cc
Examining data/kakoune-2020.01.16/src/ranges.cc
Examining data/kakoune-2020.01.16/src/regex.cc
Examining data/kakoune-2020.01.16/src/register_manager.cc
Examining data/kakoune-2020.01.16/src/scope.cc
Examining data/kakoune-2020.01.16/src/selection.cc
Examining data/kakoune-2020.01.16/src/selectors.cc
Examining data/kakoune-2020.01.16/src/shared_string.cc
Examining data/kakoune-2020.01.16/src/string.cc
Examining data/kakoune-2020.01.16/src/string_utils.cc
Examining data/kakoune-2020.01.16/src/unit_tests.cc
Examining data/kakoune-2020.01.16/src/window.cc
Examining data/kakoune-2020.01.16/src/normal.cc
Examining data/kakoune-2020.01.16/src/shell_manager.cc
Examining data/kakoune-2020.01.16/src/word_db.cc
Parsing failed to find end of parameter list; semicolon terminated it in (lhs.begin(), lhs.end(), rhs.begin(),
                       [](const RankedMatch& lhs, const StringView& rhs) {
                           return lhs.candidate() == rhs;
                       });
  
Examining data/kakoune-2020.01.16/src/event_manager.cc
Examining data/kakoune-2020.01.16/src/remote.cc
Examining data/kakoune-2020.01.16/src/option_manager.cc
Examining data/kakoune-2020.01.16/src/hook_manager.cc
Examining data/kakoune-2020.01.16/src/ranked_match.cc
Examining data/kakoune-2020.01.16/src/regex_impl.cc
Examining data/kakoune-2020.01.16/src/file.cc
Examining data/kakoune-2020.01.16/src/json.cc
Examining data/kakoune-2020.01.16/src/insert_completer.cc

FINAL RESULTS:

data/kakoune-2020.01.16/src/file.cc:369:21:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    if (force and ::chmod(zfilename, st.st_mode | S_IWUSR) < 0)
data/kakoune-2020.01.16/src/file.cc:373:38:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
        if ((force or replace) and ::chmod(zfilename, st.st_mode) < 0)
data/kakoune-2020.01.16/src/file.cc:623: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 res = readlink("/proc/self/exe", buffer, 2048);
data/kakoune-2020.01.16/src/file.cc:647: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 res = readlink("/proc/curproc/file", buffer, 2048);
data/kakoune-2020.01.16/src/assert.cc:35:18:  [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.
    int status = system(cmd.c_str());
data/kakoune-2020.01.16/src/highlighters.cc:1140:13:  [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.
            snprintf(buffer, 16, format, std::abs(line_to_format));
data/kakoune-2020.01.16/src/json_ui.cc:30:9:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        sprintf(buffer, R"("#%02x%02x%02x")", color.r, color.g, color.b);
data/kakoune-2020.01.16/src/remote.cc:571:5:  [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(addr.sun_path, session_path(session).c_str());
data/kakoune-2020.01.16/src/file.cc:84:25:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
        if (char* res = realpath(existing.zstr(), buffer))
data/kakoune-2020.01.16/src/file.cc:135:25:  [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.
    StringView tmpdir = getenv("TMPDIR");
data/kakoune-2020.01.16/src/file.cc:144: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.
    StringView home = getenv("HOME");
data/kakoune-2020.01.16/src/file.cc:571:32:  [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.
    for (auto dir : StringView{getenv("PATH")} | split<StringView>(':'))
data/kakoune-2020.01.16/src/file.cc:635:28:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
    char* canonical_path = realpath(buffer, nullptr);
data/kakoune-2020.01.16/src/main.cc:152:34:  [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.
    if (StringView kak_cfg_dir = getenv("KAKOUNE_CONFIG_DIR"); not kak_cfg_dir.empty())
data/kakoune-2020.01.16/src/main.cc:154:35:  [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.
    if (StringView xdg_cfg_home = getenv("XDG_CONFIG_HOME"); not xdg_cfg_home.empty())
data/kakoune-2020.01.16/src/remote.cc:537:12:  [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.
    return getenv("USER");
data/kakoune-2020.01.16/src/remote.cc:542:34:  [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.
    StringView xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
data/kakoune-2020.01.16/src/remote.cc:551:34:  [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.
    StringView xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
data/kakoune-2020.01.16/src/shell_manager.cc:47: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.
    if (const char* shell = getenv("KAKOUNE_POSIX_SHELL"))
data/kakoune-2020.01.16/src/shell_manager.cc:74:28:  [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* path = getenv("PATH");
data/kakoune-2020.01.16/src/backtrace.cc:55:26:  [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.
    alignas(SYMBOL_INFO) char symbol_info_buffer[sizeof(SYMBOL_INFO) + 256];
data/kakoune-2020.01.16/src/backtrace.cc:64: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 desc[276];
data/kakoune-2020.01.16/src/buffer_utils.cc:143: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 data[buffer_size];
data/kakoune-2020.01.16/src/color.cc:67: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[11];
data/kakoune-2020.01.16/src/color.cc:68:9:  [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(buffer, "rgb:%02x%02x%02x", color.r, color.g, color.b);
data/kakoune-2020.01.16/src/commands.cc: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(parse_filename(filename).c_str(), O_RDONLY | O_NONBLOCK);
data/kakoune-2020.01.16/src/file.cc:77: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[PATH_MAX+1];
data/kakoune-2020.01.16/src/file.cc:98: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 cwd[1024];
data/kakoune-2020.01.16/src/file.cc:111: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 cwd[1024];
data/kakoune-2020.01.16/src/file.cc:176: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[bufsize];
data/kakoune-2020.01.16/src/file.cc:199: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(filename.zstr(), O_RDONLY);
data/kakoune-2020.01.16/src/file.cc:210: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).
    fd = open(filename.zstr(), O_RDONLY | O_NONBLOCK);
data/kakoune-2020.01.16/src/file.cc:267:20:  [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).
    const int fd = open(filename.zstr(), O_CREAT | O_WRONLY | O_TRUNC, 0644);
data/kakoune-2020.01.16/src/file.cc:291: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(m_buffer + (int)m_pos, data.data(), (int)write_len);
data/kakoune-2020.01.16/src/file.cc:307: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 m_buffer[(int)size];
data/kakoune-2020.01.16/src/file.cc:345:12:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
    return mkstemp(buffer);
data/kakoune-2020.01.16/src/file.cc:350: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[PATH_MAX];
data/kakoune-2020.01.16/src/file.cc:377: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 temp_filename[PATH_MAX];
data/kakoune-2020.01.16/src/file.cc:379:30:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
                           : open(zfilename, O_CREAT | O_WRONLY | O_TRUNC, 0644);
data/kakoune-2020.01.16/src/file.cc:463: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[PATH_MAX+1];
data/kakoune-2020.01.16/src/file.cc:590: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(&cache.mtim, &st.st_mtim, sizeof(TimeSpec));
data/kakoune-2020.01.16/src/file.cc:621: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[2048];
data/kakoune-2020.01.16/src/hash.cc:41: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(&key, blocks + 4*i, 4);
data/kakoune-2020.01.16/src/highlighters.cc:1129: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 format[16];
data/kakoune-2020.01.16/src/highlighters.cc:1139: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 buffer[16];
data/kakoune-2020.01.16/src/json.cc:30: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[7] = {'\\', *next, 0};
data/kakoune-2020.01.16/src/json.cc:32:13:  [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(buf, "\\u%04x", *next);
data/kakoune-2020.01.16/src/json_ui.cc:29: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[10];
data/kakoune-2020.01.16/src/json_ui.cc:314: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[bufsize];
data/kakoune-2020.01.16/src/main.cc:141: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 relpath[PATH_MAX+1];
data/kakoune-2020.01.16/src/main.cc:635: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 tty = open("/dev/tty", O_RDONLY);
data/kakoune-2020.01.16/src/ncurses_ui.cc:503: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[4 + 511 + 2] = "\033]2;";
data/kakoune-2020.01.16/src/ncurses_ui.cc:530:20:  [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).
    const int fd = open("/dev/tty", O_RDWR);
data/kakoune-2020.01.16/src/regex_impl.cc:1088: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[20];
data/kakoune-2020.01.16/src/regex_impl.cc:1089:9:  [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(buf, " %03d     ", count++);
data/kakoune-2020.01.16/src/remote.cc:61: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(m_buffer.data() + m_start + sizeof(MessageType), &count, sizeof(uint32_t));
data/kakoune-2020.01.16/src/remote.cc:240: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(&res, m_stream.data() + sizeof(MessageType), sizeof(uint32_t));
data/kakoune-2020.01.16/src/remote.cc:254: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, m_stream.data() + m_read_pos, size);
data/kakoune-2020.01.16/src/shared_string.cc:19: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(data, str.begin(), (size_t)str.length());
data/kakoune-2020.01.16/src/shell_manager.cc:25:9:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
#define vfork fork
data/kakoune-2020.01.16/src/shell_manager.cc:125:21:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
    if (pid_t pid = vfork())
data/kakoune-2020.01.16/src/shell_manager.cc:199:18:  [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).
            move(open("/dev/null", O_RDONLY), 0);
data/kakoune-2020.01.16/src/shell_manager.cc:219: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 buffer[1024];
data/kakoune-2020.01.16/src/string.cc:29: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(l.ptr, data, size);
data/kakoune-2020.01.16/src/string.cc:54: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(data(), other.data(), new_size+1);
data/kakoune-2020.01.16/src/string.cc:94: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(new_ptr, data(), size()+1);
data/kakoune-2020.01.16/src/string.cc:120: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(data() + size(), str, len);
data/kakoune-2020.01.16/src/string.cc:165: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(s.string, data, size);
data/kakoune-2020.01.16/src/string_utils.cc:142: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.
    res.m_length = sprintf(res.m_data, "%i", val);
data/kakoune-2020.01.16/src/string_utils.cc:149: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.
    res.m_length = sprintf(res.m_data, "%u", val);
data/kakoune-2020.01.16/src/string_utils.cc:156: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.
    res.m_length = sprintf(res.m_data, "%li", val);
data/kakoune-2020.01.16/src/string_utils.cc:163: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.
    res.m_length = sprintf(res.m_data, "%lli", val);
data/kakoune-2020.01.16/src/string_utils.cc:170: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.
    res.m_length = sprintf(res.m_data, "%lu", val);
data/kakoune-2020.01.16/src/string_utils.cc:177: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.
    res.m_length = sprintf(res.m_data, "%zx", val.val);
data/kakoune-2020.01.16/src/string_utils.cc:184: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.
    res.m_length = sprintf(res.m_data, "%f", val);
data/kakoune-2020.01.16/src/string_utils.cc:423: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[20];
data/kakoune-2020.01.16/src/backtrace.cc:35:17:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        size += strlen(symbols[i]) + 1;
data/kakoune-2020.01.16/src/buffer_utils.cc:148:41:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                const ssize_t count = ::read(fifo, data, buffer_size);
data/kakoune-2020.01.16/src/file.cc:177:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while (ssize_t size = read(fd, buf, bufsize))
data/kakoune-2020.01.16/src/file.cc:451:29:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
            auto old_mask = umask(0);
data/kakoune-2020.01.16/src/file.cc:452:61:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
            auto restore_mask = on_scope_end([old_mask]() { umask(old_mask); });
data/kakoune-2020.01.16/src/insert_completer.cc:422:18:  [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::equal(ref.begin(), ref.end(), pos - prefix_len))
data/kakoune-2020.01.16/src/insert_completer.cc:488:30:  [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::equal(ref.begin(), ref.end(), pos - prefix_len);
data/kakoune-2020.01.16/src/json_ui.cc:317:26:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        ssize_t size = ::read(0, buf, bufsize);
data/kakoune-2020.01.16/src/ncurses_ui.cc:587:43:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (fd_readable(STDIN_FILENO) and read(STDIN_FILENO, &c, 1) == 1)
data/kakoune-2020.01.16/src/remote.cc:164:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        static T read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:168:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            reader.read(reinterpret_cast<char*>(&res), sizeof(T));
data/kakoune-2020.01.16/src/remote.cc:175:34:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        static Vector<T, domain> read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:177:47:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            uint32_t size = Reader<uint32_t>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:181:52:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                res.push_back(std::move(Reader<T>::read(reader)));
data/kakoune-2020.01.16/src/remote.cc:188:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        static HashMap<Key, Value, domain> read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:190:47:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            uint32_t size = Reader<uint32_t>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:195:41:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto key = Reader<Key>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:196:43:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto val = Reader<Value>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:205:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        static Optional<T> read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:207:35:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (not Reader<bool>::read(reader))
data/kakoune-2020.01.16/src/remote.cc:209:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            return Reader<T>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:250:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    void read(char* buffer, size_t size)
data/kakoune-2020.01.16/src/remote.cc:259:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    T read()
data/kakoune-2020.01.16/src/remote.cc:261:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        return Reader<T>::read(*this);
data/kakoune-2020.01.16/src/remote.cc:275:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        int res = ::read(sock, m_stream.data() + m_write_pos, size);
data/kakoune-2020.01.16/src/remote.cc:289:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    static String read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:291:47:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        ByteCount length = Reader<ByteCount>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:296:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            reader.read(&res[0_byte], (int)length);
data/kakoune-2020.01.16/src/remote.cc:304:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    static Color read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:307:48:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        res.color = Reader<Color::NamedColor>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:310:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            res.r = Reader<unsigned char>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:311:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            res.g = Reader<unsigned char>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:312:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            res.b = Reader<unsigned char>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:320:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    static DisplayAtom read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:322:42:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        String content = Reader<String>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:323:51:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        return {std::move(content), Reader<Face>::read(reader)};
data/kakoune-2020.01.16/src/remote.cc:329:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    static DisplayLine read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:331:46:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        return {Reader<Vector<DisplayAtom>>::read(reader)};
data/kakoune-2020.01.16/src/remote.cc:337:26:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    static DisplayBuffer read(MsgReader& reader)
data/kakoune-2020.01.16/src/remote.cc:340:51:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        db.lines() = Reader<Vector<DisplayLine>>::read(reader);
data/kakoune-2020.01.16/src/remote.cc:435:40:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                   auto key = m_reader.read<Key>();
data/kakoune-2020.01.16/src/remote.cc:630:39:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto choices = reader.read<Vector<DisplayLine>>();
data/kakoune-2020.01.16/src/remote.cc:631:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto anchor = reader.read<DisplayCoord>();
data/kakoune-2020.01.16/src/remote.cc:632:34:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto fg = reader.read<Face>();
data/kakoune-2020.01.16/src/remote.cc:633:34:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto bg = reader.read<Face>();
data/kakoune-2020.01.16/src/remote.cc:634:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto style = reader.read<MenuStyle>();
data/kakoune-2020.01.16/src/remote.cc:639:42:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                m_ui->menu_select(reader.read<int>());
data/kakoune-2020.01.16/src/remote.cc:646:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto title = reader.read<DisplayLine>();
data/kakoune-2020.01.16/src/remote.cc:647:39:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto content = reader.read<DisplayLineList>();
data/kakoune-2020.01.16/src/remote.cc:648:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto anchor = reader.read<DisplayCoord>();
data/kakoune-2020.01.16/src/remote.cc:649:36:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto face = reader.read<Face>();
data/kakoune-2020.01.16/src/remote.cc:650:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto style = reader.read<InfoStyle>();
data/kakoune-2020.01.16/src/remote.cc:659:46:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto display_buffer = reader.read<DisplayBuffer>();
data/kakoune-2020.01.16/src/remote.cc:660:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto default_face = reader.read<Face>();
data/kakoune-2020.01.16/src/remote.cc:661:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto padding_face = reader.read<Face>();
data/kakoune-2020.01.16/src/remote.cc:667:43:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto status_line = reader.read<DisplayLine>();
data/kakoune-2020.01.16/src/remote.cc:668:41:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto mode_line = reader.read<DisplayLine>();
data/kakoune-2020.01.16/src/remote.cc:669:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto default_face = reader.read<Face>();
data/kakoune-2020.01.16/src/remote.cc:675:36:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto mode = reader.read<CursorMode>();
data/kakoune-2020.01.16/src/remote.cc:676:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto coord = reader.read<DisplayCoord>();
data/kakoune-2020.01.16/src/remote.cc:681:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                m_ui->refresh(reader.read<bool>());
data/kakoune-2020.01.16/src/remote.cc:684:45:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                m_ui->set_ui_options(reader.read<HashMap<String, String, MemoryDomain::Options>>());
data/kakoune-2020.01.16/src/remote.cc:687:40:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                m_exit_status = reader.read<int>();
data/kakoune-2020.01.16/src/remote.cc:747:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto pid = m_reader.read<int>();
data/kakoune-2020.01.16/src/remote.cc:748:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto name = m_reader.read<String>();
data/kakoune-2020.01.16/src/remote.cc:749:43:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto init_cmds = m_reader.read<String>();
data/kakoune-2020.01.16/src/remote.cc:750:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto init_coord = m_reader.read<Optional<BufferCoord>>();
data/kakoune-2020.01.16/src/remote.cc:751:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto dimensions = m_reader.read<DisplayCoord>();
data/kakoune-2020.01.16/src/remote.cc:752:42:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto env_vars = m_reader.read<HashMap<String, String, MemoryDomain::EnvVars>>();
data/kakoune-2020.01.16/src/remote.cc:764:41:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                auto command = m_reader.read<String>();
data/kakoune-2020.01.16/src/remote.cc:810:21:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    auto old_mask = umask(0077);
data/kakoune-2020.01.16/src/remote.cc:811:53:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    auto restore_mask = on_scope_end([old_mask]() { umask(old_mask); });
data/kakoune-2020.01.16/src/shell_manager.cc:222:49:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                                size_t size = ::read(pipe.read_fd(), buffer, 1024);
data/kakoune-2020.01.16/src/word_db.cc:230:18:  [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::equal(lhs.begin(), lhs.end(), rhs.begin(),

ANALYSIS SUMMARY:

Hits = 150
Lines analyzed = 25185 in approximately 0.78 seconds (32485 lines/second)
Physical Source Lines of Code (SLOC) = 21825
Hits@level = [0]   1 [1]  74 [2]  56 [3]  12 [4]   4 [5]   4
Hits@level+ = [0+] 151 [1+] 150 [2+]  76 [3+]  20 [4+]   8 [5+]   4
Hits/KSLOC@level+ = [0+] 6.91867 [1+] 6.87285 [2+] 3.48225 [3+] 0.91638 [4+] 0.366552 [5+] 0.183276
Symlinks skipped = 5 (--allowlink overrides but see doc for security issue)
Dot directories skipped = 2 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.