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/matanza-0.13+ds2/xmltok_impl.c
Examining data/matanza-0.13+ds2/nametab.h
Examining data/matanza-0.13+ds2/xmlparse.h
Examining data/matanza-0.13+ds2/latin1tab.h
Examining data/matanza-0.13+ds2/xmltok_impl.h
Examining data/matanza-0.13+ds2/utf8tab.h
Examining data/matanza-0.13+ds2/xmldef.h
Examining data/matanza-0.13+ds2/acconfig.h
Examining data/matanza-0.13+ds2/xmltok.h
Examining data/matanza-0.13+ds2/shipreal.c
Examining data/matanza-0.13+ds2/ascii.h
Examining data/matanza-0.13+ds2/getopt1.c
Examining data/matanza-0.13+ds2/xmltok_ns.c
Examining data/matanza-0.13+ds2/asciitab.h
Examining data/matanza-0.13+ds2/xmlrole.c
Examining data/matanza-0.13+ds2/iasciitab.h
Examining data/matanza-0.13+ds2/xmltok.c
Examining data/matanza-0.13+ds2/mmp.h
Examining data/matanza-0.13+ds2/getopt.h
Examining data/matanza-0.13+ds2/winconfig.h
Examining data/matanza-0.13+ds2/getopt.c
Examining data/matanza-0.13+ds2/xmlrole.h
Examining data/matanza-0.13+ds2/xmlparse.c

FINAL RESULTS:

data/matanza-0.13+ds2/getopt.c:213:9:  [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.
#ifndef getenv
data/matanza-0.13+ds2/getopt.c:214: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.
extern char *getenv ();
data/matanza-0.13+ds2/getopt.c:406: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.
  posixly_correct = getenv ("POSIXLY_CORRECT");
data/matanza-0.13+ds2/getopt.c:969:1:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
getopt (argc, argv, optstring)
data/matanza-0.13+ds2/getopt.c:999:11:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
      c = getopt (argc, argv, "abc:d:0123456789");
data/matanza-0.13+ds2/getopt.h:106:12:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt (int argc, char *const *argv, const char *shortopts);
data/matanza-0.13+ds2/getopt.h:108:12:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt ();
data/matanza-0.13+ds2/getopt.h:110:12:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
data/matanza-0.13+ds2/getopt.h:122:12:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt ();
data/matanza-0.13+ds2/getopt.h:123:12:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
extern int getopt_long ();
data/matanza-0.13+ds2/getopt1.c:69:1:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
getopt_long (argc, argv, options, long_options, opt_index)
data/matanza-0.13+ds2/getopt1.c:125:11:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
      c = getopt_long (argc, argv, "abc:d:0123456789",
data/matanza-0.13+ds2/xmlparse.c:116: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).
  char open;
data/matanza-0.13+ds2/xmlparse.c:922: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(buffer, end, nLeftOver);
data/matanza-0.13+ds2/xmlparse.c:929: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(XML_GetBuffer(parser, len), s, len);
data/matanza-0.13+ds2/xmlparse.c:979:2:  [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(newBuf, bufferPtr, bufferEnd - bufferPtr);
data/matanza-0.13+ds2/xmlparse.c:1265: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).
	if (entity->open)
data/matanza-0.13+ds2/xmlparse.c:1354:4:  [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(tag->buf, tag->rawName, tag->rawNameLength);
data/matanza-0.13+ds2/xmlparse.c:1817: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(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
data/matanza-0.13+ds2/xmlparse.c:1824: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(binding->uri + binding->uriLen, localPart, i * sizeof(XML_Char));
data/matanza-0.13+ds2/xmlparse.c:1860: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(b->uri, uri, len * sizeof(XML_Char));
data/matanza-0.13+ds2/xmlparse.c:2071: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 encodingBuf[128];
data/matanza-0.13+ds2/xmlparse.c:2657: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).
	if (entity->open)
data/matanza-0.13+ds2/xmlparse.c:2923: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).
	else if (entity->open) {
data/matanza-0.13+ds2/xmlparse.c:2986: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).
	if (entity->open) {
data/matanza-0.13+ds2/xmlparse.c:3337:13:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if (!e->open)
data/matanza-0.13+ds2/xmlparse.c:3453: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(&tem, p1, sizeof(DTD));
data/matanza-0.13+ds2/xmlparse.c:3454: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(p1, p2, sizeof(DTD));
data/matanza-0.13+ds2/xmlparse.c:3455: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(p2, &tem, sizeof(DTD));
data/matanza-0.13+ds2/xmlparse.c:3889: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(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char));
data/matanza-0.13+ds2/xmlparse.c:3920: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(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char));
data/matanza-0.13+ds2/xmltok.c:123: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 type[256];
data/matanza-0.13+ds2/xmltok.c:883: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[1];
data/matanza-0.13+ds2/xmltok.c:917: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).
  char open;
data/matanza-0.13+ds2/xmltok.c:976: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).
    if (c == open)
data/matanza-0.13+ds2/xmltok.c:1176: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[256][4];
data/matanza-0.13+ds2/xmltok.c:1217: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[XML_UTF8_ENCODE_MAX];
data/matanza-0.13+ds2/xmltok.c:1275: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 *)mem)[i] = ((char *)&latin1_encoding)[i];
data/matanza-0.13+ds2/xmltok_impl.c:572:6:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
	int open;
data/matanza-0.13+ds2/xmltok_impl.c:584:12:  [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).
	  switch (open) {
data/matanza-0.13+ds2/xmltok_impl.c:601:13:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
	  if (t == open)
data/matanza-0.13+ds2/xmltok_impl.c:936:25:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
int PREFIX(scanLit)(int open, const ENCODING *enc,
data/matanza-0.13+ds2/xmltok_impl.c:947:16:  [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 (t != open)
data/matanza-0.13+ds2/xmltok_impl.c:1489:53:  [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).
	           || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))
data/matanza-0.13+ds2/xmltok_ns.c:61: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[ENCODING_MAX];
data/matanza-0.13+ds2/getopt.c:236:51:  [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 (!defined __STDC__ || !__STDC__) && !defined strlen
data/matanza-0.13+ds2/getopt.c:239: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).
extern int strlen (const char *);
data/matanza-0.13+ds2/getopt.c:437:44:  [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 = nonoption_flags_max_len = strlen (orig_str);
data/matanza-0.13+ds2/getopt.c:658: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).
		== (unsigned int) strlen (p->name))
data/matanza-0.13+ds2/getopt.c:682: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).
	  nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:712: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).
		  nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:728: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).
		  nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:733: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).
	  nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:844:51:  [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 ((unsigned int) (nameend - nextchar) == strlen (p->name))
data/matanza-0.13+ds2/getopt.c:867: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).
	    nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:887:19:  [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).
		    nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:901:19:  [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).
		    nextchar += strlen (nextchar);
data/matanza-0.13+ds2/getopt.c:905: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).
	    nextchar += strlen (nextchar);

ANALYSIS SUMMARY:

Hits = 58
Lines analyzed = 12396 in approximately 0.28 seconds (43684 lines/second)
Physical Source Lines of Code (SLOC) = 10151
Hits@level = [0]  35 [1]  13 [2]  33 [3]  12 [4]   0 [5]   0
Hits@level+ = [0+]  93 [1+]  58 [2+]  45 [3+]  12 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 9.16166 [1+] 5.71372 [2+] 4.43306 [3+] 1.18215 [4+]   0 [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.