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/swath-0.6.1/conv/convfact.cxx
Examining data/swath-0.6.1/conv/tischar.h
Examining data/swath-0.6.1/conv/tis620.h
Examining data/swath-0.6.1/conv/conv.cxx
Examining data/swath-0.6.1/conv/utf8.cxx
Examining data/swath-0.6.1/conv/tis620.cxx
Examining data/swath-0.6.1/conv/unichar.h
Examining data/swath-0.6.1/conv/conv.h
Examining data/swath-0.6.1/conv/convfact.h
Examining data/swath-0.6.1/conv/convkit.h
Examining data/swath-0.6.1/conv/utf8.h
Examining data/swath-0.6.1/src/longwordseg.cpp
Examining data/swath-0.6.1/src/filterlatex.cpp
Examining data/swath-0.6.1/src/filterlambda.h
Examining data/swath-0.6.1/src/filefilter.h
Examining data/swath-0.6.1/src/filterrtf.h
Examining data/swath-0.6.1/src/wordstack.h
Examining data/swath-0.6.1/src/utils.h
Examining data/swath-0.6.1/src/abswordseg.h
Examining data/swath-0.6.1/src/maxwordseg.cpp
Examining data/swath-0.6.1/src/filterx.h
Examining data/swath-0.6.1/src/maxwordseg.h
Examining data/swath-0.6.1/src/longwordseg.h
Examining data/swath-0.6.1/src/convutil.h
Examining data/swath-0.6.1/src/filefilter.cpp
Examining data/swath-0.6.1/src/worddef.h
Examining data/swath-0.6.1/src/filterhtml.h
Examining data/swath-0.6.1/src/filterlatex.h
Examining data/swath-0.6.1/src/abswordseg.cpp
Examining data/swath-0.6.1/src/wordseg.cpp
Examining data/swath-0.6.1/src/filterrtf.cpp
Examining data/swath-0.6.1/src/dict.h
Examining data/swath-0.6.1/src/filterhtml.cpp
Examining data/swath-0.6.1/src/dict.cpp
Examining data/swath-0.6.1/src/convutil.cpp

FINAL RESULTS:

data/swath-0.6.1/src/abswordseg.cpp:154:3:  [4] (buffer) wcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer.
  wcscpy (text, senstr);
data/swath-0.6.1/src/dict.cpp:41:7:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
      sprintf (trieBuff, "%s" PATH_SEP DICT_FILENAME, dictPath);
data/swath-0.6.1/src/wordseg.cpp:56:18:  [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.
      dictpath = getenv ("SWATHDICT");
data/swath-0.6.1/src/abswordseg.h:28:3:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  wchar_t text[MAXLEN];
data/swath-0.6.1/src/convutil.cpp:55: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 uniBuff[10];
data/swath-0.6.1/src/convutil.cpp:77: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 output[MAXLEN * 2 * 5];
data/swath-0.6.1/src/dict.cpp:26:7:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
Dict::open (const char* dictPath)
data/swath-0.6.1/src/dict.h:39: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).
  bool   open (const char* dictPath);
data/swath-0.6.1/src/dict.h:91:3:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  open (dictPath);
data/swath-0.6.1/src/filterlatex.h:22:3:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  wchar_t buffer[MAXLEN];
data/swath-0.6.1/src/filterrtf.cpp:42: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       val[1024];
data/swath-0.6.1/src/filterrtf.cpp:269:23:  [2] (buffer) wcscat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Risk is low because the source is a constant string.
                      wcscat (strbuff, L"\\'");
data/swath-0.6.1/src/filterrtf.cpp:611: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 utfBuff[10];
data/swath-0.6.1/src/filterrtf.h:41:3:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  wchar_t    strbuff[40];
data/swath-0.6.1/src/wordseg.cpp:51:17:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
      if (dict->open (dictpath))
data/swath-0.6.1/src/wordseg.cpp:57:29:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
      if (dictpath && dict->open (dictpath))
data/swath-0.6.1/src/wordseg.cpp:60:17:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
      if (dict->open ("."))
data/swath-0.6.1/src/wordseg.cpp:63:17:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
      if (dict->open (WORDSEGDATA_DIR))
data/swath-0.6.1/src/wordseg.cpp:261:3:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  wchar_t wLine[MAXLEN];
data/swath-0.6.1/src/wordseg.cpp:262:3:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  wchar_t wsegOut[MAXLEN * 2];
data/swath-0.6.1/src/wordseg.cpp:318:11:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
          wchar_t wToken[MAXLEN];
data/swath-0.6.1/src/abswordseg.cpp:155:13:  [1] (buffer) wcslen:
  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).
  textLen = wcslen (senstr);
data/swath-0.6.1/src/convutil.cpp:46:12:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    return fgetc (fpin);
data/swath-0.6.1/src/convutil.cpp:48:11:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int c = fgetc (fpin);
data/swath-0.6.1/src/convutil.cpp:60:17:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      int inp = fgetc (fpin);
data/swath-0.6.1/src/convutil.cpp:102:33:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  wchar_t* output = new wchar_t[strlen (s) + 1];
data/swath-0.6.1/src/dict.cpp:40: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).
      trieBuff = new char[strlen (dictPath) + 2 + sizeof (DICT_FILENAME)];
data/swath-0.6.1/src/filterlatex.cpp:28:3:  [1] (buffer) wcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  wcsncpy (token, buffer, nCopy);
data/swath-0.6.1/src/filterlatex.cpp:48:59:  [1] (buffer) wcslen:
  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).
          curPtr += consumeToken (token, tokenSz, buffer, wcslen (buffer));
data/swath-0.6.1/src/filterlatex.cpp:49:37:  [1] (buffer) wcslen:
  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).
          wmemmove (buffer, curPtr, wcslen (curPtr) + 1);
data/swath-0.6.1/src/filterlatex.cpp:53:25:  [1] (buffer) wcslen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
          int verbLen = wcslen (L"\\end{verbatim}");
data/swath-0.6.1/src/filterlatex.cpp:59:37:  [1] (buffer) wcslen:
  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).
          wmemmove (buffer, curPtr, wcslen (curPtr) + 1);
data/swath-0.6.1/src/filterlatex.cpp:95:43:  [1] (buffer) wcslen:
  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).
              wmemmove (buffer, beginPtr, wcslen (beginPtr) + 1);
data/swath-0.6.1/src/filterlatex.cpp:115:19:  [1] (buffer) wcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer. Risk is low because the source is a constant character.
                  wcscpy (pToken, L"\n");
data/swath-0.6.1/src/filterlatex.cpp:126:19:  [1] (buffer) wcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer. Risk is low because the source is a constant character.
                  wcscpy (pToken, L"\n");
data/swath-0.6.1/src/filterlatex.cpp:140:35:  [1] (buffer) wcslen:
  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).
      wmemmove (buffer, beginPtr, wcslen (beginPtr) + 1);
data/swath-0.6.1/src/filterlatex.cpp:152:31:  [1] (buffer) wcslen:
  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).
  wmemmove (buffer, beginPtr, wcslen (beginPtr) + 1);
data/swath-0.6.1/src/filterrtf.cpp:111:38:  [1] (buffer) wcslen:
  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).
      nCopy = min<int> (tokenSz - 1, wcslen (strbuff));
data/swath-0.6.1/src/filterrtf.cpp:115:43:  [1] (buffer) wcslen:
  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).
      wmemmove (strbuff, strbuff + nCopy, wcslen (strbuff + nCopy) + 1);
data/swath-0.6.1/src/filterrtf.cpp:119:36:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      while (!charConsumed || (c = fgetc (fpin)) != EOF)
data/swath-0.6.1/src/filterrtf.cpp:125:46:  [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).
              nCopy = min<int> (tokenSz - 1, strlen (rtfToken.getVal()));
data/swath-0.6.1/src/filterrtf.cpp:155:31:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                    int len = strlen (rtfToken.getVal());
data/swath-0.6.1/src/filterrtf.cpp:177:33:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                      int len = strlen (rtfToken.getVal());
data/swath-0.6.1/src/filterrtf.cpp:219:36:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      while (!charConsumed || (c = fgetc (fpin)) != EOF)
data/swath-0.6.1/src/filterrtf.cpp:227:33:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                                strlen (rtfToken.getVal()));
data/swath-0.6.1/src/filterrtf.cpp:306:36:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      while (!charConsumed || (c = fgetc (fpin)) != EOF)
data/swath-0.6.1/src/filterrtf.cpp:312:46:  [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).
              nCopy = min<int> (tokenSz - 1, strlen (rtfToken.getVal()));
data/swath-0.6.1/src/filterrtf.cpp:339:31:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                    int len = strlen (rtfToken.getVal());
data/swath-0.6.1/src/filterrtf.cpp:359:33:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                      int len = strlen (rtfToken.getVal());
data/swath-0.6.1/src/filterrtf.cpp:405:17:  [1] (buffer) wcslen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      int len = wcslen (strbuff);
data/swath-0.6.1/src/wordseg.cpp:99:16:  [1] (buffer) wcslen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  int wbrLen = wcslen (wbr);
data/swath-0.6.1/src/wordseg.cpp:106:7:  [1] (buffer) wcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      wcsncpy (output, pLine, outLen);
data/swath-0.6.1/src/wordseg.cpp:113:7:  [1] (buffer) wcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      wcsncpy (output, wbr, wbrLen);
data/swath-0.6.1/src/wordseg.cpp:120:3:  [1] (buffer) wcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  wcsncpy (output, pLine, outputSz);
data/swath-0.6.1/src/wordseg.cpp:303:21:  [1] (buffer) wcslen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
          int len = wcslen (wLine);

ANALYSIS SUMMARY:

Hits = 55
Lines analyzed = 3006 in approximately 0.08 seconds (39368 lines/second)
Physical Source Lines of Code (SLOC) = 2332
Hits@level = [0]  29 [1]  34 [2]  18 [3]   1 [4]   2 [5]   0
Hits@level+ = [0+]  84 [1+]  55 [2+]  21 [3+]   3 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 36.0206 [1+] 23.5849 [2+] 9.00515 [3+] 1.28645 [4+] 0.857633 [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.