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/zmakebas-1.2/zmakebas.c

FINAL RESULTS:

data/zmakebas-1.2/zmakebas.c:419:11:  [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(startlabel,optarg+1);
data/zmakebas-1.2/zmakebas.c:446: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(outfile,optarg);
data/zmakebas-1.2/zmakebas.c:487: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(infile,argv[optind]);
data/zmakebas-1.2/zmakebas.c:543:1:  [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(outfile,DEFAULT_OUTPUT);
data/zmakebas-1.2/zmakebas.c:661:9:  [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(labels[labelend++],linestart+1);
data/zmakebas-1.2/zmakebas.c:183:5:  [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.
int getopt(int argc,char *argv[],char *optstring)
data/zmakebas-1.2/zmakebas.c:412:10:  [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.
  switch(getopt(argc,argv,"a:hi:ln:o:rs:"))
data/zmakebas-1.2/zmakebas.c:143: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.
unsigned char filebuf[32768];
data/zmakebas-1.2/zmakebas.c:144: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 infile[256],outfile[256];
data/zmakebas-1.2/zmakebas.c:147: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.
unsigned char filebuf[49152];
data/zmakebas-1.2/zmakebas.c:148: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 infile[1024],outfile[1024];
data/zmakebas-1.2/zmakebas.c:154: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.
unsigned char headerbuf[17];
data/zmakebas-1.2/zmakebas.c:159: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 speccy_filename[11];
data/zmakebas-1.2/zmakebas.c:162: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.
unsigned char labels[MAX_LABELS][MAX_LABEL_LEN+1];
data/zmakebas-1.2/zmakebas.c:165: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.
unsigned char startlabel[MAX_LABEL_LEN+1];
data/zmakebas-1.2/zmakebas.c:422:33:  [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).
        startline=(unsigned int)atoi(optarg);
data/zmakebas-1.2/zmakebas.c:432:21:  [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).
      autoincr=(int)atoi(optarg);
data/zmakebas-1.2/zmakebas.c:451:22:  [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).
      autostart=(int)atoi(optarg);
data/zmakebas-1.2/zmakebas.c:525: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.
static unsigned char buf[512],lcasebuf[512],outbuf[1024];
data/zmakebas-1.2/zmakebas.c:527: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.
static unsigned char buf[2048],lcasebuf[2048],outbuf[4096];
data/zmakebas-1.2/zmakebas.c:547:33:  [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(strcmp(infile,"-")!=0 && (in=fopen(infile,"r"))==NULL)
data/zmakebas-1.2/zmakebas.c:800: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.
            unsigned char numbuf[20];
data/zmakebas-1.2/zmakebas.c:808:13:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
            sprintf(numbuf,"%d",label_lines[f]);
data/zmakebas-1.2/zmakebas.c:813: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(ptr,numbuf,len);
data/zmakebas-1.2/zmakebas.c:925: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(outptr,ptr,ptr2-ptr);
data/zmakebas-1.2/zmakebas.c:965: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(fileptr,outbuf,linelen);
data/zmakebas-1.2/zmakebas.c:997:35:  [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(strcmp(outfile,"-")!=0 && (out=fopen(outfile,"wb"))==NULL)
data/zmakebas-1.2/zmakebas.c:188: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).
if(optind==argc || *(argv[optind])!='-' || strlen(argv[optind])<=1)
data/zmakebas-1.2/zmakebas.c:211: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(optpos>=strlen(argv[optind]))
data/zmakebas-1.2/zmakebas.c:416: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(strlen(optarg+1)>MAX_LABEL_LEN)
data/zmakebas-1.2/zmakebas.c:442:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(speccy_filename,optarg,10);
data/zmakebas-1.2/zmakebas.c:541:1:  [1] (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). Risk is low because the source is a constant character.
strcpy(speccy_filename,"");
data/zmakebas-1.2/zmakebas.c:542:1:  [1] (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). Risk is low because the source is a constant character.
strcpy(infile,"-");
data/zmakebas-1.2/zmakebas.c:572: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(buf[strlen(buf)-1]=='\n') buf[strlen(buf)-1]=0;
data/zmakebas-1.2/zmakebas.c:572:38:  [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(buf[strlen(buf)-1]=='\n') buf[strlen(buf)-1]=0;
data/zmakebas-1.2/zmakebas.c:580: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).
    while(buf[strlen(buf)-1]=='\\')
data/zmakebas-1.2/zmakebas.c:582:9:  [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).
      f=strlen(buf)-1;
data/zmakebas-1.2/zmakebas.c:585: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).
      if(buf[strlen(buf)-1]=='\n') buf[strlen(buf)-1]=0;
data/zmakebas-1.2/zmakebas.c:585: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).
      if(buf[strlen(buf)-1]=='\n') buf[strlen(buf)-1]=0;
data/zmakebas-1.2/zmakebas.c:588: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).
    if(strlen(buf)>=sizeof(buf)-MAX_LABEL_LEN-1)
data/zmakebas-1.2/zmakebas.c:736: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).
      toklen=strlen(*tarrptr);
data/zmakebas-1.2/zmakebas.c:796: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).
          int len=strlen(labels[f]);
data/zmakebas-1.2/zmakebas.c:806: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).
            memmove(ptr-1,ptr+len,strlen(ptr+len)+1);
data/zmakebas-1.2/zmakebas.c:809: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).
            len=strlen(numbuf);
data/zmakebas-1.2/zmakebas.c:812: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).
            memmove(ptr+len,ptr,strlen(ptr)+1);
data/zmakebas-1.2/zmakebas.c:1006:9:  [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).
  for(f=strlen(speccy_filename);f<10;f++)
data/zmakebas-1.2/zmakebas.c:1008:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(headerbuf+1,speccy_filename,10);

ANALYSIS SUMMARY:

Hits = 47
Lines analyzed = 1035 in approximately 0.06 seconds (17829 lines/second)
Physical Source Lines of Code (SLOC) = 738
Hits@level = [0]  49 [1]  20 [2]  20 [3]   2 [4]   5 [5]   0
Hits@level+ = [0+]  96 [1+]  47 [2+]  27 [3+]   7 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 130.081 [1+] 63.6856 [2+] 36.5854 [3+] 9.48509 [4+] 6.77507 [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.