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/ugrep-3.0.5+dfsg/include/reflex/abslexer.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/bits.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/boostmatcher.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/convert.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/debug.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/error.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/flexlexer.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/fuzzymatcher.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/input.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/matcher.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/pattern.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/pcre2matcher.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/posix.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/ranges.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/setop.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/stdmatcher.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/timer.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/traits.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/unicode.h
Examining data/ugrep-3.0.5+dfsg/include/reflex/utf8.h
Examining data/ugrep-3.0.5+dfsg/lib/block_scripts.cpp
Examining data/ugrep-3.0.5+dfsg/lib/convert.cpp
Examining data/ugrep-3.0.5+dfsg/lib/debug.cpp
Examining data/ugrep-3.0.5+dfsg/lib/error.cpp
Examining data/ugrep-3.0.5+dfsg/lib/input.cpp
Examining data/ugrep-3.0.5+dfsg/lib/language_scripts.cpp
Examining data/ugrep-3.0.5+dfsg/lib/letter_scripts.cpp
Examining data/ugrep-3.0.5+dfsg/lib/matcher.cpp
Examining data/ugrep-3.0.5+dfsg/lib/pattern.cpp
Examining data/ugrep-3.0.5+dfsg/lib/posix.cpp
Examining data/ugrep-3.0.5+dfsg/lib/unicode.cpp
Examining data/ugrep-3.0.5+dfsg/lib/utf8.cpp
Examining data/ugrep-3.0.5+dfsg/src/glob.cpp
Examining data/ugrep-3.0.5+dfsg/src/glob.hpp
Examining data/ugrep-3.0.5+dfsg/src/mmap.hpp
Examining data/ugrep-3.0.5+dfsg/src/output.cpp
Examining data/ugrep-3.0.5+dfsg/src/output.hpp
Examining data/ugrep-3.0.5+dfsg/src/query.cpp
Examining data/ugrep-3.0.5+dfsg/src/query.hpp
Examining data/ugrep-3.0.5+dfsg/src/screen.cpp
Examining data/ugrep-3.0.5+dfsg/src/screen.hpp
Examining data/ugrep-3.0.5+dfsg/src/stats.cpp
Examining data/ugrep-3.0.5+dfsg/src/stats.hpp
Examining data/ugrep-3.0.5+dfsg/src/ugrep.cpp
Examining data/ugrep-3.0.5+dfsg/src/ugrep.hpp
Examining data/ugrep-3.0.5+dfsg/src/vkey.cpp
Examining data/ugrep-3.0.5+dfsg/src/vkey.hpp
Examining data/ugrep-3.0.5+dfsg/src/zopen.c
Examining data/ugrep-3.0.5+dfsg/src/zopen.h
Examining data/ugrep-3.0.5+dfsg/src/zstream.hpp
Examining data/ugrep-3.0.5+dfsg/tests/fm.cpp

FINAL RESULTS:

data/ugrep-3.0.5+dfsg/include/reflex/debug.h:151:50:  [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.
( REFLEX_DBGOUT_(DBGFILE, __FILE__, __LINE__), ::fprintf(REFLEX_DBGFD_, "" __VA_ARGS__), ::fflush(REFLEX_DBGFD_))
data/ugrep-3.0.5+dfsg/include/reflex/debug.h:153:5:  [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(REFLEX_DBGFD_, "\n                                        " __VA_ARGS__), ::fflush(REFLEX_DBGFD_) )
data/ugrep-3.0.5+dfsg/include/reflex/debug.h:155:5:  [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(REFLEX_DBGFD_, "" __VA_ARGS__), ::fflush(REFLEX_DBGFD_) )
data/ugrep-3.0.5+dfsg/src/query.cpp:2105:9:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    if (system(command.c_str()) == 0)
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:1986:13:  [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.
            execvp(argv[0], argv);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:5286:18:  [4] (shell) popen:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
        output = popen(flag_pager, "w");
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:85:14:  [4] (shell) popen:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
inline FILE *popen(const char *command, const char *mode)
data/ugrep-3.0.5+dfsg/src/query.cpp:2063:24:  [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 *editor = getenv("GREP_EDIT");
data/ugrep-3.0.5+dfsg/src/query.cpp:2066:14:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    editor = getenv("EDITOR");
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:4552:14:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  home_dir = getenv("USERPROFILE");
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:4554:14:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  home_dir = getenv("HOME");
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:5337:30:  [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 *term = getenv("TERM");
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:190:21:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  const char *env = getenv(name);
data/ugrep-3.0.5+dfsg/include/reflex/abslexer.h:242: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 tabs[4] = "T=n";
data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h:983: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 tmp[8] = { 0 }, *s = tmp;
data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h:1020: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 tmp[8];
data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h:1035: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(&buf_[pos_], tmp, n);
data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h:1182: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 s[8];
data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h:1419: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(newbuf, buf_, end_);
data/ugrep-3.0.5+dfsg/include/reflex/absmatcher.h:1469:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        std::memcpy(newbuf, txt_, end_);
data/ugrep-3.0.5+dfsg/include/reflex/bits.h:191: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(vec_ = new uint64_t[len_], bits.vec_, len_ << 3);
data/ugrep-3.0.5+dfsg/include/reflex/bits.h:579:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        std::memcpy(p, vec_, len_ << 3);
data/ugrep-3.0.5+dfsg/include/reflex/error.h:48: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[24];
data/ugrep-3.0.5+dfsg/include/reflex/flexlexer.h:503: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[8];
data/ugrep-3.0.5+dfsg/include/reflex/input.h:648: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(s, cstring_, k);
data/ugrep-3.0.5+dfsg/include/reflex/input.h:661:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        std::memcpy(s, utf8_ + uidx_, l);
data/ugrep-3.0.5+dfsg/include/reflex/input.h:701:18:  [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(s, utf8_, k);
data/ugrep-3.0.5+dfsg/include/reflex/input.h:707:18:  [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(s, utf8_, l);
data/ugrep-3.0.5+dfsg/include/reflex/input.h:782: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                  utf8_[8]; ///< UTF-8 normalization buffer, >=8 bytes
data/ugrep-3.0.5+dfsg/include/reflex/input.h:936: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(buf_, input.buf_, len_);
data/ugrep-3.0.5+dfsg/include/reflex/input.h:960: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(buf_, input.buf_, len_);
data/ugrep-3.0.5+dfsg/include/reflex/input.h:1050: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_[SIZE];
data/ugrep-3.0.5+dfsg/include/reflex/pattern.h:972: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                  pre_[256];         ///< pattern prefix, shorter or equal to 255 bytes
data/ugrep-3.0.5+dfsg/include/reflex/utf8.h:89: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(s, REFLEX_NONCHAR_UTF8, n);
data/ugrep-3.0.5+dfsg/lib/convert.cpp:256: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[3] = { '^', static_cast<char>(lowercase(c)), '\0' };
data/ugrep-3.0.5+dfsg/lib/convert.cpp:394: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 hex[9];
data/ugrep-3.0.5+dfsg/lib/convert.cpp:526: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[16];
data/ugrep-3.0.5+dfsg/lib/convert.cpp:554:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
          char buf[8];
data/ugrep-3.0.5+dfsg/lib/convert.cpp:739: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 name[2] = { static_cast<char>(lowercase(c)), '\0' };
data/ugrep-3.0.5+dfsg/lib/convert.cpp:940: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[8] = "";
data/ugrep-3.0.5+dfsg/lib/debug.cpp:71:69:  [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).
  if (REFLEX_DBGFD_ == NULL && (log[0] == '.' || (REFLEX_DBGFD_ = ::fopen(log, "a")) == NULL))
data/ugrep-3.0.5+dfsg/lib/input.cpp:772:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char buf[4];
data/ugrep-3.0.5+dfsg/lib/input.cpp:797:18:  [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(t, utf8_, n);
data/ugrep-3.0.5+dfsg/lib/input.cpp:805:18:  [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(t, utf8_, l);
data/ugrep-3.0.5+dfsg/lib/input.cpp:836:18:  [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(t, utf8_, n);
data/ugrep-3.0.5+dfsg/lib/input.cpp:844:18:  [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(t, utf8_, l);
data/ugrep-3.0.5+dfsg/lib/input.cpp:867:18:  [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(t, utf8_, n);
data/ugrep-3.0.5+dfsg/lib/input.cpp:875:18:  [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(t, utf8_, l);
data/ugrep-3.0.5+dfsg/lib/input.cpp:898:18:  [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(t, utf8_, n);
data/ugrep-3.0.5+dfsg/lib/input.cpp:906:18:  [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(t, utf8_, l);
data/ugrep-3.0.5+dfsg/lib/input.cpp:989:18:  [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(t, utf8_, n);
data/ugrep-3.0.5+dfsg/lib/input.cpp:997:18:  [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(t, utf8_, l);
data/ugrep-3.0.5+dfsg/lib/input.cpp:1047:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char buf[4];
data/ugrep-3.0.5+dfsg/lib/input.cpp:1188:16:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
      unsigned char buf[sizeof(utf8_)];
data/ugrep-3.0.5+dfsg/lib/input.cpp:1189: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(buf, utf8_, sizeof(utf8_));
data/ugrep-3.0.5+dfsg/lib/matcher.cpp:45:19:  [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.
  static unsigned char freq[256] = "\0\0\0\0\0\0\0\0\0\73\4\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\73\70\70\1\1\2\2\70\70\70\2\2\70\70\70\2\3\3\3\3\3\3\3\3\3\3\70\70\70\70\70\70\2\35\14\24\26\37\20\17\30\33\11\12\25\22\32\34\15\7\27\31\36\23\13\21\10\16\6\70\1\70\2\70\1\67\46\56\60\72\52\51\62\65\43\44\57\54\64\66\47\41\61\63\71\55\45\53\42\50\40\70\2\70\2\0\47\47\47\47\47\47\47\47\47\47\47\47\47\47\47\47\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\45\44\44\44\44\44\44\44\44\44\44\44\44\44\44\44\44\0\0\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\46\56\56\56\56\56\56\56\56\56\56\56\56\46\56\56\73\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
data/ugrep-3.0.5+dfsg/lib/pattern.cpp:87:89:  [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).
inline int fopen_s(FILE **file, const char *name, const char *mode) { return (*file = ::fopen(name, mode)) ? 0 : errno; }
data/ugrep-3.0.5+dfsg/lib/pattern.cpp:178:7:  [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(pre_, pred + 2, len_);
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:115: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[16];
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:126:16:  [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.
  static const char *min_utf8_strict[6] = { // strict: pattern is strict, matching only strictly valid UTF-8
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:134:16:  [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.
  static const char *min_utf8_lean[6] = { // lean: pattern is permissive, matching also some invalid UTF-8 but more tightly compressed UTF-8
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:142:16:  [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.
  static const char *max_utf8[6] = {
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:151: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 any[16];
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:152:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[16];
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:153: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 at[6];
data/ugrep-3.0.5+dfsg/lib/utf8.cpp:154: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 bt[6];
data/ugrep-3.0.5+dfsg/src/output.hpp:61:19:  [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.
  struct Buffer { char data[SIZE]; }; // data buffer in the buffers container
data/ugrep-3.0.5+dfsg/src/output.hpp:239:18:  [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.
    static const char *color_hex[HEX_MAX];
data/ugrep-3.0.5+dfsg/src/output.hpp:437: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 tmp[24];
data/ugrep-3.0.5+dfsg/src/output.hpp:454: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 tmp[16];
data/ugrep-3.0.5+dfsg/src/query.cpp:202: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[2] = { '^', static_cast<char>('@' + ch) };
data/ugrep-3.0.5+dfsg/src/query.cpp:598: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(ptr, text, size);
data/ugrep-3.0.5+dfsg/src/query.cpp:881:15:  [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(line_, temp_, QUERY_MAX_LEN);
data/ugrep-3.0.5+dfsg/src/query.cpp:2735: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(temp_, line_, QUERY_MAX_LEN);
data/ugrep-3.0.5+dfsg/src/query.cpp:2739: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(line_, globs_.c_str(), num);
data/ugrep-3.0.5+dfsg/src/query.cpp:2751: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(line_, temp_, QUERY_MAX_LEN);
data/ugrep-3.0.5+dfsg/src/query.hpp:195:10:  [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.
  static char                     line_[QUERY_MAX_LEN];
data/ugrep-3.0.5+dfsg/src/query.hpp:196:10:  [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.
  static char                     temp_[QUERY_MAX_LEN];
data/ugrep-3.0.5+dfsg/src/query.hpp:223:10:  [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.
  static char                     buffer_[QUERY_BUFFER_SIZE];
data/ugrep-3.0.5+dfsg/src/query.hpp:229:10:  [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.
  static char                     searching_[16];
data/ugrep-3.0.5+dfsg/src/screen.cpp:52: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[32];
data/ugrep-3.0.5+dfsg/src/screen.cpp:65: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[32];
data/ugrep-3.0.5+dfsg/src/screen.cpp:100: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[16];
data/ugrep-3.0.5+dfsg/src/screen.cpp:140:14:  [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).
      *row = atoi(ptr + 1) - 1;
data/ugrep-3.0.5+dfsg/src/screen.cpp:147:14:  [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).
      *col = atoi(ptr + 1) - 1;
data/ugrep-3.0.5+dfsg/src/screen.cpp:249:9:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  tty = open("/dev/tty", O_RDWR);
data/ugrep-3.0.5+dfsg/src/screen.cpp:501: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 codebuf[SCREEN_MAX_CODELEN];
data/ugrep-3.0.5+dfsg/src/screen.cpp:546:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy(codeptr, text, next - text);
data/ugrep-3.0.5+dfsg/src/screen.cpp:689:15:  [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[2] = { xdigits[c >> 4], xdigits[c & 0xf] };
data/ugrep-3.0.5+dfsg/src/screen.cpp:705:17:  [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[2] = { '^', static_cast<char>('@' + wc) };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:330:1:  [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 color_sl[COLORLEN]; // selected line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:331:1:  [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 color_cx[COLORLEN]; // context line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:332:1:  [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 color_mt[COLORLEN]; // matched text in any matched line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:333:1:  [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 color_ms[COLORLEN]; // matched text in a selected line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:334:1:  [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 color_mc[COLORLEN]; // matched text in a context line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:335:1:  [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 color_fn[COLORLEN]; // file name
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:336:1:  [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 color_ln[COLORLEN]; // line number
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:337:1:  [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 color_cn[COLORLEN]; // column number
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:338:1:  [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 color_bn[COLORLEN]; // byte offset
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:339:1:  [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 color_se[COLORLEN]; // separator
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:341:1:  [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 match_ms[COLORLEN];  // --match or --tag: matched text in a selected line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:342:1:  [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 match_mc[COLORLEN];  // --match or --tag: matched text in a context line
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:343:1:  [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 match_off[COLORLEN]; // --match or --tag: off
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:519:22:  [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.
void set_color(const char *colors, const char *parameter, char color[COLORLEN]);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:519:42:  [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.
void set_color(const char *colors, const char *parameter, char color[COLORLEN]);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:519:59:  [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.
void set_color(const char *colors, const char *parameter, char color[COLORLEN]);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:690:24:  [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.
inline void copy_color(char to[COLORLEN], const char from[COLORLEN])
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:690:49:  [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.
inline void copy_color(char to[COLORLEN], const char from[COLORLEN])
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:694:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(to, from, len);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:1742: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).
          zstream->open(pathname, file);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:1795: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).
        zstream->open(pathname, file);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2156: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.
      const char ustar_magic[8] = { 'u', 's', 't', 'a', 'r', 0, '0', '0' };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2159: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.
      const char gnutar_magic[8] = { 'u', 's', 't', 'a', 'r', ' ', ' ', 0 };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2353: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.
      const char odc_magic[6] = { '0', '7', '0', '7', '0', '7' };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2356: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.
      const char newc_magic[6] = { '0', '7', '0', '7', '0', '1' };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2359: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.
      const char newc_crc_magic[6] = { '0', '7', '0', '7', '0', '2' };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2384:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
          char tmp[16];
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2391: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(tmp, buf + 59, 6);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2397: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(tmp, buf + 94, 8);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2421: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(tmp, buf + 65, 11);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2427: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(tmp, buf + 54, 8);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2447: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(tmp, buf + 18, 6);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2453: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(tmp, buf + 14, 8);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:2775: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[16384];
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:3531:15:  [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.
        const char *args[2] = { NULL, arg };
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:5401: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 color_tmp[COLORLEN];
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:9412:22:  [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.
void set_color(const char *colors, const char *parameter, char color[COLORLEN])
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:9412:42:  [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.
void set_color(const char *colors, const char *parameter, char color[COLORLEN])
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:9412:59:  [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.
void set_color(const char *colors, const char *parameter, char color[COLORLEN])
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:10378: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 errmsg[256]; 
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:10393: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 errmsg[256]; 
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:119:14:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  int size = MultiByteToWideChar(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), NULL, 0);
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:121:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), &wstr[0], size);
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:202: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, O_RDONLY); // removed O_NOATIME which may fail
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:209:19:  [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).
  return (*file = fopen(filename, mode)) == NULL ? errno : 0;
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:405:8:  [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.
extern char color_sl[COLORLEN]; // selected line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:406:8:  [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.
extern char color_cx[COLORLEN]; // context line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:407:8:  [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.
extern char color_mt[COLORLEN]; // matched text in any matched line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:408:8:  [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.
extern char color_ms[COLORLEN]; // matched text in a selected line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:409:8:  [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.
extern char color_mc[COLORLEN]; // matched text in a context line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:410:8:  [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.
extern char color_fn[COLORLEN]; // file name
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:411:8:  [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.
extern char color_ln[COLORLEN]; // line number
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:412:8:  [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.
extern char color_cn[COLORLEN]; // column number
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:413:8:  [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.
extern char color_bn[COLORLEN]; // byte offset
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:414:8:  [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.
extern char color_se[COLORLEN]; // separator
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:416:8:  [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.
extern char match_ms[COLORLEN];  // --match or --tag: matched text in a selected line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:417:8:  [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.
extern char match_mc[COLORLEN];  // --match or --tag: matched text in a context line
data/ugrep-3.0.5+dfsg/src/ugrep.hpp:418:8:  [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.
extern char match_off[COLORLEN]; // --match or --tag: off
data/ugrep-3.0.5+dfsg/src/vkey.cpp:245: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 utf8[4];
data/ugrep-3.0.5+dfsg/src/vkey.cpp:253:11:  [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(keybuf, &utf8[1], n - 1);
data/ugrep-3.0.5+dfsg/src/vkey.cpp:791:9:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  tty = open("/dev/tty", O_RDWR);
data/ugrep-3.0.5+dfsg/src/vkey.hpp:330:19:  [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.
  static unsigned char keybuf[3];
data/ugrep-3.0.5+dfsg/src/vkey.hpp:333:19:  [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.
  static unsigned char alt[127 - 32][4];
data/ugrep-3.0.5+dfsg/src/vkey.hpp:336:19:  [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.
  static unsigned char fn[12][4];
data/ugrep-3.0.5+dfsg/src/zstream.hpp:120: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(zbuf_, buf, zlen_);
data/ugrep-3.0.5+dfsg/src/zstream.hpp:623: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(buf, zbuf_ + zcur_, static_cast<size_t>(num));
data/ugrep-3.0.5+dfsg/src/zstream.hpp:776:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char zbuf_[ZIPBLOCK]; // buffer with compressed zip file data to decompress
data/ugrep-3.0.5+dfsg/src/zstream.hpp:871:5:  [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(pathname, file);
data/ugrep-3.0.5+dfsg/src/zstream.hpp:884:8:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  void open(const char *pathname, FILE *file)
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1129: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(buf, buf_ + cur_, num);
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1189:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char zbuf[Z_BUF_LEN];
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1226:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char zbuf[Z_BUF_LEN];
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1260:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char zbuf[Z_BUF_LEN];
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1625: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(buf, lz4file_->buf + lz4file_->loc, len);
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1803:11:  [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(buf, lz4file_->buf + lz4file_->loc, len);
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1902: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, buf_ + cur_, static_cast<size_t>(k));
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1906:7:  [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, buf_ + cur_, static_cast<size_t>(len_ - cur_));
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1940:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char   buf_[Z_BUF_LEN]; // buffer with decompressed stream data
data/ugrep-3.0.5+dfsg/include/reflex/input.h:386:36:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      size_(cstring != NULL ? std::strlen(cstring) : 0)
data/ugrep-3.0.5+dfsg/include/reflex/input.h:729:88:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      size_t k = static_cast<size_t>(n == 1 ? istream_->get(s[0]).gcount() : istream_->read(s, static_cast<std::streamsize>(n)) ? n : istream_->gcount());
data/ugrep-3.0.5+dfsg/include/reflex/pattern.h:781:30:  [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 rex_.compare(loc, strlen(s), s) == 0;
data/ugrep-3.0.5+dfsg/lib/convert.cpp:1282: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).
  size_t len = std::strlen(pattern);
data/ugrep-3.0.5+dfsg/lib/error.cpp:71: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).
  size_t l = strlen(message);
data/ugrep-3.0.5+dfsg/lib/pattern.cpp:1229:36:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      loc += static_cast<Location>(strlen(posix_class[i]));
data/ugrep-3.0.5+dfsg/lib/pattern.cpp:2403:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (read)
data/ugrep-3.0.5+dfsg/lib/pattern.cpp:2494:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              if (read)
data/ugrep-3.0.5+dfsg/lib/pattern.cpp:2546:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (read)
data/ugrep-3.0.5+dfsg/src/output.cpp:451:29:  [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).
            quote(pathname, strlen(pathname));
data/ugrep-3.0.5+dfsg/src/output.cpp:471: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).
          quote(pathname, strlen(pathname));
data/ugrep-3.0.5+dfsg/src/query.cpp:233:35:  [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).
        start_ = static_cast<int>(strlen(prompt_));
data/ugrep-3.0.5+dfsg/src/query.cpp:1497:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        ssize_t nread = read(search_pipe_[0], buffer_ + buflen_, QUERY_BUFFER_SIZE - buflen_);
data/ugrep-3.0.5+dfsg/src/query.cpp:2227:20:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        size_t n = strlen(cwd);
data/ugrep-3.0.5+dfsg/src/screen.cpp:477:12:  [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(text);
data/ugrep-3.0.5+dfsg/src/screen.hpp:265:15:  [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).
    put(text, strlen(text));
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:692:25:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  size_t len = std::min(strlen(from), static_cast<size_t>(COLORLEN - 1));
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:1877:20:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      size_t sep = strlen(suffix);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:6805:20:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      size_t len = strlen(pathname);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:6870:20:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      size_t len = strlen(pathname);
data/ugrep-3.0.5+dfsg/src/ugrep.cpp:9366:16:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  size_t len = strlen(path);
data/ugrep-3.0.5+dfsg/src/vkey.cpp:325:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if (read(tty, &ch, 1) <= 0)
data/ugrep-3.0.5+dfsg/src/vkey.cpp:349:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if (read(tty, &ch, 1) == 1)
data/ugrep-3.0.5+dfsg/src/zstream.hpp:420:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          if (read())
data/ugrep-3.0.5+dfsg/src/zstream.hpp:496:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          if (read())
data/ugrep-3.0.5+dfsg/src/zstream.hpp:573:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          if (read())
data/ugrep-3.0.5+dfsg/src/zstream.hpp:617:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          if (zcur_ < zlen_ || read())
data/ugrep-3.0.5+dfsg/src/zstream.hpp:751:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    bool read()
data/ugrep-3.0.5+dfsg/src/zstream.hpp:836:18:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    size_t end = strlen(dot);
data/ugrep-3.0.5+dfsg/src/zstream.hpp:837:36:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    if (match + end > extensions + strlen(extensions))
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1865:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int_type read()
data/ugrep-3.0.5+dfsg/src/zstream.hpp:1882:41:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    return cur_ < len_ ? buf_[cur_++] : read();

ANALYSIS SUMMARY:

Hits = 200
Lines analyzed = 55279 in approximately 1.34 seconds (41187 lines/second)
Physical Source Lines of Code (SLOC) = 45506
Hits@level = [0] 275 [1]  32 [2] 155 [3]   6 [4]   7 [5]   0
Hits@level+ = [0+] 475 [1+] 200 [2+] 168 [3+]  13 [4+]   7 [5+]   0
Hits/KSLOC@level+ = [0+] 10.4382 [1+] 4.39502 [2+] 3.69182 [3+] 0.285677 [4+] 0.153826 [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.