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/grfcodec-6.0.6/src/messages.h
Examining data/grfcodec-6.0.6/src/act79D.cpp
Examining data/grfcodec-6.0.6/src/message_mgr.cpp
Examining data/grfcodec-6.0.6/src/file.h
Examining data/grfcodec-6.0.6/src/act123_classes.cpp
Examining data/grfcodec-6.0.6/src/inject.h
Examining data/grfcodec-6.0.6/src/act0.cpp
Examining data/grfcodec-6.0.6/src/language_mgr.h
Examining data/grfcodec-6.0.6/src/utf8.h
Examining data/grfcodec-6.0.6/src/md5.h
Examining data/grfcodec-6.0.6/src/md5.cpp
Examining data/grfcodec-6.0.6/src/actF.cpp
Examining data/grfcodec-6.0.6/src/nfosprite.h
Examining data/grfcodec-6.0.6/src/sanity.cpp
Examining data/grfcodec-6.0.6/src/act6.cpp
Examining data/grfcodec-6.0.6/src/file.cpp
Examining data/grfcodec-6.0.6/src/inject.cpp
Examining data/grfcodec-6.0.6/src/sprites.h
Examining data/grfcodec-6.0.6/src/path.cpp
Examining data/grfcodec-6.0.6/src/help.cpp
Examining data/grfcodec-6.0.6/src/pcxfile.h
Examining data/grfcodec-6.0.6/src/sanity_defines.h
Examining data/grfcodec-6.0.6/src/sprites.cpp
Examining data/grfcodec-6.0.6/src/messages.cpp
Examining data/grfcodec-6.0.6/src/error.cpp
Examining data/grfcodec-6.0.6/src/pcxfile.cpp
Examining data/grfcodec-6.0.6/src/pseudo.h
Examining data/grfcodec-6.0.6/src/message_mgr.h
Examining data/grfcodec-6.0.6/src/act0.h
Examining data/grfcodec-6.0.6/src/utf8.cpp
Examining data/grfcodec-6.0.6/src/sanity.h
Examining data/grfcodec-6.0.6/src/readinfo.cpp
Examining data/grfcodec-6.0.6/src/command.h
Examining data/grfcodec-6.0.6/src/ExpandingArray.h
Examining data/grfcodec-6.0.6/src/pngsprit.cpp
Examining data/grfcodec-6.0.6/src/data.h
Examining data/grfcodec-6.0.6/src/error.h
Examining data/grfcodec-6.0.6/src/grfcodec.cpp
Examining data/grfcodec-6.0.6/src/rangedint.cpp
Examining data/grfcodec-6.0.6/src/conv.h
Examining data/grfcodec-6.0.6/src/act123.h
Examining data/grfcodec-6.0.6/src/rangedint.h
Examining data/grfcodec-6.0.6/src/pcxsprit.cpp
Examining data/grfcodec-6.0.6/src/help.h
Examining data/grfcodec-6.0.6/src/language_mgr.cpp
Examining data/grfcodec-6.0.6/src/globals.cpp
Examining data/grfcodec-6.0.6/src/globals.h
Examining data/grfcodec-6.0.6/src/nforenum.h
Examining data/grfcodec-6.0.6/src/strings.h
Examining data/grfcodec-6.0.6/src/mapescapes.cpp
Examining data/grfcodec-6.0.6/src/path.h
Examining data/grfcodec-6.0.6/src/mapescapes.h
Examining data/grfcodec-6.0.6/src/pseudo_seq.cpp
Examining data/grfcodec-6.0.6/src/info.cpp
Examining data/grfcodec-6.0.6/src/act5.cpp
Examining data/grfcodec-6.0.6/src/singleton.h
Examining data/grfcodec-6.0.6/src/win32.h
Examining data/grfcodec-6.0.6/src/pngsprit.h
Examining data/grfcodec-6.0.6/src/actB.cpp
Examining data/grfcodec-6.0.6/src/act123.cpp
Examining data/grfcodec-6.0.6/src/ttdpal.h
Examining data/grfcodec-6.0.6/src/allocarray.h
Examining data/grfcodec-6.0.6/src/pcxsprit.h
Examining data/grfcodec-6.0.6/src/pseudo.cpp
Examining data/grfcodec-6.0.6/src/info.h
Examining data/grfcodec-6.0.6/src/inlines.h
Examining data/grfcodec-6.0.6/src/escapes.h
Examining data/grfcodec-6.0.6/src/data.cpp
Examining data/grfcodec-6.0.6/src/grfstrip.cpp
Examining data/grfcodec-6.0.6/src/typesize.h
Examining data/grfcodec-6.0.6/src/IDs.cpp
Examining data/grfcodec-6.0.6/src/act14.cpp
Examining data/grfcodec-6.0.6/src/strings.cpp
Examining data/grfcodec-6.0.6/src/grfcomm.cpp
Examining data/grfcodec-6.0.6/src/lang/extra_english.h
Examining data/grfcodec-6.0.6/src/lang/all_help.h
Examining data/grfcodec-6.0.6/src/lang/language_list.h
Examining data/grfcodec-6.0.6/src/lang/all_extra.h
Examining data/grfcodec-6.0.6/src/lang/help_czech.h
Examining data/grfcodec-6.0.6/src/lang/message_english.h
Examining data/grfcodec-6.0.6/src/lang/help_english.h
Examining data/grfcodec-6.0.6/src/lang/extra_czech.h
Examining data/grfcodec-6.0.6/src/lang/all_messages.h
Examining data/grfcodec-6.0.6/src/lang/message_czech.h
Examining data/grfcodec-6.0.6/src/endian_check.cpp
Examining data/grfcodec-6.0.6/src/nforenum.cpp
Examining data/grfcodec-6.0.6/src/grfid.cpp
Examining data/grfcodec-6.0.6/src/grfcomm.h
Examining data/grfcodec-6.0.6/src/command.cpp

FINAL RESULTS:

data/grfcodec-6.0.6/src/error.cpp:14:2:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
	vsprintf(buffer, format, argptr);
data/grfcodec-6.0.6/src/grfcodec.cpp:227:6:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
	if (access(realfile, F_OK) == 0) {
data/grfcodec-6.0.6/src/grfcomm.cpp:204:2:  [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(bakfile, filename); // Safe use due to already checked buffer size
data/grfcodec-6.0.6/src/command.cpp:36: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.
#include<getopt.h>
data/grfcodec-6.0.6/src/data.cpp:1100: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.
		home=safetostring(getenv("HOME"));
data/grfcodec-6.0.6/src/data.cpp:1101:27:  [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.
		homedrpath=safetostring(getenv("HOMEDRIVE"))+safetostring(getenv("HOMEPATH"));
data/grfcodec-6.0.6/src/data.cpp:1101:61:  [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.
		homedrpath=safetostring(getenv("HOMEDRIVE"))+safetostring(getenv("HOMEPATH"));
data/grfcodec-6.0.6/src/grfcodec.cpp:932:14:  [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.
		char opt = getopt(argc, argv, "dev?w:h:b:up:m:M:o:tfxqcsXg:n");
data/grfcodec-6.0.6/src/language_mgr.cpp:36:33:  [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.
	string langCode = safetostring(getenv("LANG"));
data/grfcodec-6.0.6/src/nforenum.cpp:35: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.
#include<getopt.h>
data/grfcodec-6.0.6/src/nforenum.cpp:146:19:  [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.
		if(opt!=EOF)opt=getopt_long(argc,argv,"ac:D::fhksv" "b:de:L:l:pr:o:w:W:",optlist,&longind);
data/grfcodec-6.0.6/src/command.cpp:529:7:  [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).
		val=atoi(pch);
data/grfcodec-6.0.6/src/data.cpp:1120:13:  [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).
	FILE*pFile=fopen((dir+name).c_str(),mode);
data/grfcodec-6.0.6/src/endian_check.cpp:22: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 c[4];
data/grfcodec-6.0.6/src/error.cpp:9:2:  [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 buffer[256];
data/grfcodec-6.0.6/src/file.cpp:32: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).
	FILE *f = fopen(filename, mode);
data/grfcodec-6.0.6/src/grfcodec.cpp:210:14:  [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).
	FILE *tmp = fopen(bakfile, "rb");
data/grfcodec-6.0.6/src/grfcodec.cpp:308:15:  [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).
	thecurfile = fopen(thecurfilename, "wb");
data/grfcodec-6.0.6/src/grfcodec.cpp:395:17:  [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).
				FILE *bin = fopen(bininclude, "rb");
data/grfcodec-6.0.6/src/grfcodec.cpp:663:8:  [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).
	grf = fopen(file, "rb");
data/grfcodec-6.0.6/src/grfcodec.cpp:807: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).
	FILE *f = fopen(filearg, "rb");
data/grfcodec-6.0.6/src/grfcodec.cpp:822: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 fmt[16];
data/grfcodec-6.0.6/src/grfcodec.cpp:885:2:  [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 base[MAXFILE];
data/grfcodec-6.0.6/src/grfcodec.cpp:913:2:  [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 directory[MAXDIR];
data/grfcodec-6.0.6/src/grfcodec.cpp:948:20:  [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).
			width = min(max(atoi(optarg), 16), 65535);
data/grfcodec-6.0.6/src/grfcodec.cpp:951: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).
			height = min(max(atoi(optarg), 16), 65535);
data/grfcodec-6.0.6/src/grfcodec.cpp:954:10:  [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).
			box = atoi(optarg);
data/grfcodec-6.0.6/src/grfcodec.cpp:961:13:  [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).
			palnum = atoi(optarg);
data/grfcodec-6.0.6/src/grfcodec.cpp:975: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).
			grfcontversion = atoi(optarg);
data/grfcodec-6.0.6/src/grfcodec.cpp:982:13:  [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).
			mapnum = atoi(optarg);
data/grfcodec-6.0.6/src/grfcomm.cpp:40:2:  [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 bdrive[MAXDRIVE], bdirectory[MAXDIR], bname[MAXFILE], bext[MAXEXT];
data/grfcodec-6.0.6/src/grfcomm.cpp:41:2:  [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 sdrive[MAXDRIVE], sdirectory[MAXDIR];
data/grfcodec-6.0.6/src/grfcomm.cpp:47: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 sfullpath[MAXPATH];
data/grfcodec-6.0.6/src/grfcomm.cpp:109: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.
	static char filename[MAXFILE];
data/grfcodec-6.0.6/src/grfcomm.cpp:110:2:  [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 directory[MAXDIR];
data/grfcodec-6.0.6/src/grfcomm.cpp:121: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).
		sprite = fopen(filename, mode);
data/grfcodec-6.0.6/src/grfcomm.cpp:158:6:  [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).
	f = fopen(fn, mode);
data/grfcodec-6.0.6/src/grfcomm.cpp:207:2:  [2] (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 string.
	strcpy(c, ".bak"); // Safe use due to already checked buffer size
data/grfcodec-6.0.6/src/grfid.cpp:111: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).
	FILE *f = fopen(filename, "rb");
data/grfcodec-6.0.6/src/grfid.cpp:177: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).
	FILE *f = fopen(filename, "rb");
data/grfcodec-6.0.6/src/grfstrip.cpp:77:14:  [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).
	FILE *fin = fopen(origin, "rb");
data/grfcodec-6.0.6/src/grfstrip.cpp:80:15:  [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).
	FILE *fout = fopen(dest, "wb");
data/grfcodec-6.0.6/src/info.cpp:35:4:  [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).
	f.open(fn);
data/grfcodec-6.0.6/src/info.cpp:54:13:  [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).
		infover = atoi(buffer.c_str() + 17);
data/grfcodec-6.0.6/src/info.cpp:257:17:  [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).
				FILE *bin = fopen(filename, "wb");
data/grfcodec-6.0.6/src/md5.cpp:169: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(xbuf, data, 64);
data/grfcodec-6.0.6/src/md5.cpp:343: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(pms->buf + offset, p, copy);
data/grfcodec-6.0.6/src/md5.cpp:357: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(pms->buf, p, left);
data/grfcodec-6.0.6/src/messages.cpp:123:42:  [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).
			if(isdigit(fmt[++i]))i+=(int)itoa(pad=atoi(fmt+i)).length();
data/grfcodec-6.0.6/src/nforenum.cpp:203: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).
		fin.open((infilename=basename).c_str());
data/grfcodec-6.0.6/src/nforenum.cpp:205: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).
			fin.open((infilename=basename+nfo_ext).c_str());
data/grfcodec-6.0.6/src/nforenum.cpp:209: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).
			fout.open((outfilename=(replace?basename+new_ext:basename+new_ext+nfo_ext)).c_str());
data/grfcodec-6.0.6/src/nforenum.cpp:212: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).
			fin.open((infilename=dirname+basename).c_str());
data/grfcodec-6.0.6/src/nforenum.cpp:215: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).
				fin.open((infilename=dirname+basename+nfo_ext).c_str());
data/grfcodec-6.0.6/src/nforenum.cpp:218: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).
				fout.open((outfilename=dirname+(replace?basename+new_ext:basename+new_ext+nfo_ext)).c_str());
data/grfcodec-6.0.6/src/path.cpp:60:2:  [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[ MAXPATH+2 ];
data/grfcodec-6.0.6/src/pcxsprit.cpp:40: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 digitlines[40] = {
data/grfcodec-6.0.6/src/pcxsprit.cpp:172:2:  [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 spritenum[10];
data/grfcodec-6.0.6/src/pcxsprit.cpp:175:3:  [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(spritenum, "%X", spriteno);
data/grfcodec-6.0.6/src/pcxsprit.cpp:177:3:  [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(spritenum, "%d", spriteno);
data/grfcodec-6.0.6/src/readinfo.cpp:56: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.
const char *zoom_levels[ZOOM_LEVELS] = { "normal", "zi4", "zi2", "zo2", "zo4", "zo8" };
data/grfcodec-6.0.6/src/readinfo.cpp:57: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.
const char *depths[DEPTHS] = { "8bpp", "32bpp", "mask" };
data/grfcodec-6.0.6/src/readinfo.cpp:204: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 depth[8],zoom[8],flags[2][8];
data/grfcodec-6.0.6/src/sprites.cpp:108: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(out, in, infobytes);
data/grfcodec-6.0.6/src/sprites.h:29: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.
extern const char *zoom_levels[ZOOM_LEVELS];
data/grfcodec-6.0.6/src/sprites.h:32: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.
extern const char *depths[DEPTHS];
data/grfcodec-6.0.6/src/strings.cpp:422:2:  [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 buffer[102];
data/grfcodec-6.0.6/src/act0.cpp:186:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if((ch=fgetc(pFile))==EOF)
data/grfcodec-6.0.6/src/act123.cpp:65:78:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
bool CheckSpriteNum(uint num,uint offset,act123::Act1&act1,uint feature,bool&mismatch,bool&hasGround){
data/grfcodec-6.0.6/src/act123.cpp:68:30:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
		if(feature!=act1.feature&&!mismatch){
data/grfcodec-6.0.6/src/act123.cpp:309:38:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
				}else if(feature!=act1.feature&&!mismatch&&!no1){
data/grfcodec-6.0.6/src/act123.cpp:337:73:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
			if(ground&&!(ground_flags&0x06))CheckSpriteNum(ground,4,act1,feature,mismatch,hasGround);
data/grfcodec-6.0.6/src/act123.cpp:357:71:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
						if(!CheckSpriteNum(building,off,act123::Instance().act1,feature,mismatch,hasGround)&&
data/grfcodec-6.0.6/src/act123.cpp:406:49:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
					if(!CheckSpriteNum(building,8,act1,feature,mismatch,hasGround)&&
data/grfcodec-6.0.6/src/act123_classes.cpp:379:17:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		_p[i].bits[0]=fgetc(pFile);
data/grfcodec-6.0.6/src/act123_classes.cpp:380:17:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		_p[i].bits[1]=fgetc(pFile);
data/grfcodec-6.0.6/src/act123_classes.cpp:381:21:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		_p[i].numtriggers=fgetc(pFile);
data/grfcodec-6.0.6/src/command.cpp:252:18:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					uint maxVer=fgetc(pFile);
data/grfcodec-6.0.6/src/data.cpp:1131:6:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if(fgetc(pFile)==data[file].data[0]&&fgetc(pFile)>=data[file].data[1]){
data/grfcodec-6.0.6/src/data.cpp:1131:40:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if(fgetc(pFile)==data[file].data[0]&&fgetc(pFile)>=data[file].data[1]){
data/grfcodec-6.0.6/src/data.cpp:1132:29:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if(file>datfeat && (uint)fgetc(pFile)<MaxFeature()){
data/grfcodec-6.0.6/src/data.cpp:1162:2:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	fgetc(pFile);
data/grfcodec-6.0.6/src/data.cpp:1163:2:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	fgetc(pFile);
data/grfcodec-6.0.6/src/data.cpp:1164:27:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if(file>datfeat && (uint)fgetc(pFile)<MaxFeature()){
data/grfcodec-6.0.6/src/data.cpp:1182:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	int ret=fgetc(pFile);
data/grfcodec-6.0.6/src/data.cpp:1183:24:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	return ret|(_CheckEOF(fgetc(pFile),file,src,line)<<8);
data/grfcodec-6.0.6/src/data.h:87:37:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
#define GetCheckByte(name) CheckEOF(fgetc(pFile),name)
data/grfcodec-6.0.6/src/grfcodec.cpp:412: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).
				const char *nameofs = bininclude + strlen(bininclude);
data/grfcodec-6.0.6/src/grfcodec.cpp:420: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 namelen = strlen(nameofs);
data/grfcodec-6.0.6/src/grfcodec.cpp:702:3:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		fgetc(grf); // Compression
data/grfcodec-6.0.6/src/grfcodec.cpp:848:52:  [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 (fgets(fmt, sizeof(fmt), f) != NULL && fmt[strlen(fmt)-1] != '\n' ) {}// Name: ...
data/grfcodec-6.0.6/src/grfcodec.cpp:849:52:  [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 (fgets(fmt, sizeof(fmt), f) != NULL && fmt[strlen(fmt)-1] != '\n' ) {}// Columns: ...
data/grfcodec-6.0.6/src/grfcodec.cpp:860:53:  [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 (fgets(fmt, sizeof(fmt), f) != NULL && fmt[strlen(fmt)-1] != '\n' ) {}// color name
data/grfcodec-6.0.6/src/grfcodec.cpp:1031: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).
	int offset = strlen(directory);
data/grfcodec-6.0.6/src/grfcodec.cpp:1038:4:  [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(directory) < 1) ||
data/grfcodec-6.0.6/src/grfcodec.cpp:1039:4:  [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(grffile) < 1) ||
data/grfcodec-6.0.6/src/grfcomm.cpp:46:6:  [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(sdrive)) {		// drive given, go relative
data/grfcodec-6.0.6/src/grfcomm.cpp:54:6:  [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(sdirectory)) {
data/grfcodec-6.0.6/src/grfcomm.cpp:55:70:  [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 offset = (sdirectory[0] == '\\' || sdirectory[0] == '/') ? 0 : strlen(bdirectory);
data/grfcodec-6.0.6/src/grfcomm.cpp:60: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).
		int offset = strlen(bname);
data/grfcodec-6.0.6/src/grfcomm.cpp:116: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).
	size_t dir_len = strlen(directory);
data/grfcodec-6.0.6/src/grfcomm.cpp:175:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read != size * n) {
data/grfcodec-6.0.6/src/grfcomm.cpp:176:66:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		fperror("\nError while %s, got %d, wanted %d, at %ld", action, read, size * n,
data/grfcodec-6.0.6/src/grfcomm.cpp:201: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).
	int len = strlen(filename) + 4 + 1;
data/grfcodec-6.0.6/src/grfcomm.cpp:206:24:  [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 (!c) c = bakfile + strlen(bakfile);
data/grfcodec-6.0.6/src/grfcomm.cpp:216:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(dest, src, n);
data/grfcodec-6.0.6/src/info.cpp:246: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).
				int len = strlen(this->directory) + namelen + 1;
data/grfcodec-6.0.6/src/path.cpp:25: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).
	return dest + strlen(dest);
data/grfcodec-6.0.6/src/path.cpp:81: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).
	if ((Wrk = strlen(pathP)) > MAXPATH)
data/grfcodec-6.0.6/src/pcxfile.cpp:411:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		byte = fgetc(curfile);
data/grfcodec-6.0.6/src/pcxfile.cpp:414:11:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			byte = fgetc(curfile);
data/grfcodec-6.0.6/src/pcxsprit.cpp:179: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).
	newlastx = subx+strlen(spritenum)*(DIGITWIDTH+1)+dx;
data/grfcodec-6.0.6/src/readinfo.cpp:205:14:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		int read = sscanf(meta,"%7s %d %d %d %d %d %d %7s %7s %7s",depth,&inf.xpos,&inf.ypos,&sx,&sy,&rx,&ry,zoom,flags[0],flags[1]);
data/grfcodec-6.0.6/src/readinfo.cpp:206:30:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if(strcmp(depth,"mask")==0?read!=3:read < 8){
data/grfcodec-6.0.6/src/readinfo.cpp:206:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if(strcmp(depth,"mask")==0?read!=3:read < 8){
data/grfcodec-6.0.6/src/readinfo.cpp:235:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			for (int i = 8; i < read; i++) {
data/grfcodec-6.0.6/src/sprites.cpp:207:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		U8 data = fgetc(grf);
data/grfcodec-6.0.6/src/sprites.cpp:219:16:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		this->zoom = fgetc(grf);
data/grfcodec-6.0.6/src/sprites.cpp:223:16:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		this->info = fgetc(grf);
data/grfcodec-6.0.6/src/sprites.cpp:226:16:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		this->ydim = fgetc(grf);
data/grfcodec-6.0.6/src/strings.cpp:51:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		_p[i]=fgetc(pFile);
data/grfcodec-6.0.6/src/strings.cpp:427: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).
		if(buffer[strlen(buffer)-1]!='\n'){
data/grfcodec-6.0.6/src/strings.cpp:428:7:  [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(buffer)==101)
data/grfcodec-6.0.6/src/strings.cpp:435: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).
		buffer[strlen(buffer)-1]='\0';

ANALYSIS SUMMARY:

Hits = 124
Lines analyzed = 17762 in approximately 0.58 seconds (30380 lines/second)
Physical Source Lines of Code (SLOC) = 13372
Hits@level = [0] 157 [1]  57 [2]  56 [3]   8 [4]   3 [5]   0
Hits@level+ = [0+] 281 [1+] 124 [2+]  67 [3+]  11 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 21.0141 [1+] 9.27311 [2+] 5.01047 [3+] 0.822614 [4+] 0.224349 [5+]   0
Dot directories skipped = 2 (--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.