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/z80asm-1.8/expressions.c
Examining data/z80asm-1.8/gnulib/getopt.c
Examining data/z80asm-1.8/gnulib/getopt.h
Examining data/z80asm-1.8/gnulib/getopt1.c
Examining data/z80asm-1.8/gnulib/gettext.h
Examining data/z80asm-1.8/z80asm.c
Examining data/z80asm-1.8/z80asm.h

FINAL RESULTS:

data/z80asm-1.8/z80asm.c:111:7:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      vfprintf (stderr, fmt, l);
data/z80asm-1.8/z80asm.c:116:3:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  vfprintf (stderr, fmt, l);
data/z80asm-1.8/z80asm.c:223:7:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
      strcpy (tmp, i->name);
data/z80asm-1.8/z80asm.c:224:7:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
      strcat (tmp, name);
data/z80asm-1.8/z80asm.c:266:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy (i->name, name);
data/z80asm-1.8/z80asm.c:754:7:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
      strcpy (tmp->file, stack[sp].name);
data/z80asm-1.8/z80asm.c:766:4:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
	  strcpy (tmp->dir->name, stack[sp].dir->name);
data/z80asm-1.8/z80asm.c:775:7:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
      strcpy (tmp->input, p);
data/z80asm-1.8/z80asm.c:1546:7:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
      strcpy (&buffer[newpos], stack[sp].macro_args[arg->which]);
data/z80asm-1.8/z80asm.c:1550:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy (&buffer[newpos], &stack[sp].macro_line->line[pos]);
data/z80asm-1.8/z80asm.c:2527:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
		strcpy (name->name, nm);
data/z80asm-1.8/z80asm.c:2643:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
		strcpy (m->name, lastlabel->name);
data/z80asm-1.8/gnulib/getopt.c:195: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/z80asm-1.8/gnulib/getopt.c:196: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/z80asm-1.8/gnulib/getopt.c:344: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/z80asm-1.8/gnulib/getopt.c:1131: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 (int argc, char *const *argv, const char *optstring)
data/z80asm-1.8/gnulib/getopt.c:1156: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/z80asm-1.8/gnulib/getopt.h:142: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/z80asm-1.8/gnulib/getopt.h:144: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/z80asm-1.8/gnulib/getopt.h:148: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,
data/z80asm-1.8/gnulib/getopt1.c:64: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 (int argc,
data/z80asm-1.8/gnulib/getopt1.c:89:18:  [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.
libc_hidden_def (getopt_long)
data/z80asm-1.8/gnulib/getopt1.c:120: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/z80asm-1.8/z80asm.c:350:15:  [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.
      switch (getopt_long (argc, argv, short_opts, opts, NULL))
data/z80asm-1.8/z80asm.c:191:18:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  if (!(retval = fopen (name, flags)))
data/z80asm-1.8/z80asm.c:208:12:  [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).
  result = fopen (name, flags);
data/z80asm-1.8/z80asm.c:225:16:  [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).
      result = fopen (tmp, flags);
data/z80asm-1.8/z80asm.c:282:19:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
  if (!(*backup = tmpfile ()))
data/z80asm-1.8/z80asm.c:294: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[BUFLEN];
data/z80asm-1.8/z80asm.c:1484: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.
      static char short_buffer[BUFLEN + 1];
data/z80asm-1.8/z80asm.c:1502: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, short_buffer, BUFLEN + 1);
data/z80asm-1.8/z80asm.c:1543: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[newpos], &stack[sp].macro_line->line[pos],
data/z80asm-1.8/z80asm.c:1592: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 (args[numargs - 1], c, *ptr - c);
data/z80asm-1.8/z80asm.c:1622:21:  [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).
	  stack[sp].file = fopen (infile[file].name, "r");
data/z80asm-1.8/z80asm.c:2566: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 filebuffer[4096];
data/z80asm-1.8/z80asm.h:83:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char name[1];			/* space with name in it */
data/z80asm-1.8/z80asm.h:97:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char name[1];
data/z80asm-1.8/z80asm.h:104: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[1];
data/z80asm-1.8/z80asm.h:164: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 input[1];		/* variable size buffer containing formula */
data/z80asm-1.8/expressions.c:200: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).
      s1 = strlen (l->name);
data/z80asm-1.8/gnulib/getopt.c:375: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/z80asm-1.8/gnulib/getopt.c:600: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/z80asm-1.8/gnulib/getopt.c:645: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/z80asm-1.8/gnulib/getopt.c:711: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/z80asm-1.8/gnulib/getopt.c:745: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/z80asm-1.8/gnulib/getopt.c:750: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/z80asm-1.8/gnulib/getopt.c:937: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/z80asm-1.8/gnulib/getopt.c:977: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/z80asm-1.8/gnulib/getopt.c:1015: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/z80asm-1.8/gnulib/getopt.c:1047: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/z80asm-1.8/gnulib/getopt.c:1051: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/z80asm-1.8/z80asm.c:217: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).
      char *tmp = malloc (strlen (i->name) + strlen (name) + 1);
data/z80asm-1.8/z80asm.c:217: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).
      char *tmp = malloc (strlen (i->name) + strlen (name) + 1);
data/z80asm-1.8/z80asm.c:260: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).
  i = malloc (sizeof (struct includedir) + strlen (name) + 1);
data/z80asm-1.8/z80asm.c:267: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).
  if (name[strlen (name) - 1] != '/')
data/z80asm-1.8/z80asm.c:268:5:  [1] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant character.
    strcat (i->name, "/");
data/z80asm-1.8/z80asm.c:464:11:  [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).
      l = strlen (list[i]);
data/z80asm-1.8/z80asm.c:575:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy (buf->name, *p, c - *p - 1);
data/z80asm-1.8/z80asm.c:741:49:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      tmp = malloc (sizeof (struct reference) + strlen (p));
data/z80asm-1.8/z80asm.c:747: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).
      tmp->file = malloc (strlen (stack[sp].name) + 1);
data/z80asm-1.8/z80asm.c:757:23:  [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).
	  tmp->dir = malloc (strlen (stack[sp].dir->name)
data/z80asm-1.8/z80asm.c:1447: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).
  name = malloc (strlen (*ptr));
data/z80asm-1.8/z80asm.c:1451:3:  [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 (*ptr) - 1, *ptr);
data/z80asm-1.8/z80asm.c:1490:11:  [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 (strlen (short_buffer) < BUFLEN)
data/z80asm-1.8/z80asm.c:1507: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).
	      || (buffer[strlen (buffer) - 1] == '\n'))
data/z80asm-1.8/z80asm.c:1530:10:  [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 (stack[sp].macro_line->line) + 1;
data/z80asm-1.8/z80asm.c:1532:13:  [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 (stack[sp].macro_args[arg->which]);
data/z80asm-1.8/z80asm.c:1547: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).
      newpos += strlen (stack[sp].macro_args[arg->which]);
data/z80asm-1.8/z80asm.c:1789:40:  [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).
	      (*current_line)->line = malloc (strlen (buffer) + 1);
data/z80asm-1.8/z80asm.c:1806:8:  [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 (firstmacro->args[p])) == 0)
data/z80asm-1.8/z80asm.c:1822:13:  [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).
			  ptr += strlen (firstmacro->args[p]) - 1;
data/z80asm-1.8/z80asm.c:2520:41:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
		name = malloc (sizeof (struct name) + strlen (nm));
data/z80asm-1.8/z80asm.c:2636: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).
		m->name = malloc (strlen (lastlabel->name) + 1);
data/z80asm-1.8/z80asm.c:2681:34:  [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 (strncmp (m->name, ptr, strlen (m->name)) == 0)
data/z80asm-1.8/z80asm.c:2699:11:  [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).
			ptr += strlen (m->name);

ANALYSIS SUMMARY:

Hits = 75
Lines analyzed = 5463 in approximately 0.18 seconds (30635 lines/second)
Physical Source Lines of Code (SLOC) = 4440
Hits@level = [0] 131 [1]  36 [2]  15 [3]  12 [4]  12 [5]   0
Hits@level+ = [0+] 206 [1+]  75 [2+]  39 [3+]  24 [4+]  12 [5+]   0
Hits/KSLOC@level+ = [0+] 46.3964 [1+] 16.8919 [2+] 8.78378 [3+] 5.40541 [4+] 2.7027 [5+]   0
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.