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/jp2a-1.1.0/include/aspect_ratio.h
Examining data/jp2a-1.1.0/include/curl.h
Examining data/jp2a-1.1.0/include/html.h
Examining data/jp2a-1.1.0/include/image.h
Examining data/jp2a-1.1.0/include/jp2a.h
Examining data/jp2a-1.1.0/include/options.h
Examining data/jp2a-1.1.0/include/round.h
Examining data/jp2a-1.1.0/include/terminal.h
Examining data/jp2a-1.1.0/src/aspect_ratio.c
Examining data/jp2a-1.1.0/src/curl.c
Examining data/jp2a-1.1.0/src/html.c
Examining data/jp2a-1.1.0/src/image.c
Examining data/jp2a-1.1.0/src/jp2a.c
Examining data/jp2a-1.1.0/src/options.c
Examining data/jp2a-1.1.0/src/terminal.c

FINAL RESULTS:

data/jp2a-1.1.0/src/image.c:156:21:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
						if ( !highl ) fprintf(f, PRINTF_FORMAT_TYPE, ch);
data/jp2a-1.1.0/src/image.c:160:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
						fprintf(f, "\e[%dm" PRINTF_FORMAT_TYPE, colr, ch); // ANSI color
data/jp2a-1.1.0/src/image.c:170:8:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
							fprintf(f, "\e[%d;5;0%dm" PRINTF_FORMAT_TYPE, type, 0, ch);
data/jp2a-1.1.0/src/image.c:175:8:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
							fprintf(f, "\e[%d;5;%dm" PRINTF_FORMAT_TYPE, type, 231, ch);
data/jp2a-1.1.0/src/image.c:179:8:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
							fprintf(f, "\e[%d;5;%dm" PRINTF_FORMAT_TYPE, type, ROUND(24.0f*Y) + 232, ch);
data/jp2a-1.1.0/src/image.c:184:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
						fprintf(f, "\e[%d;5;%dm" PRINTF_FORMAT_TYPE, type, 16 + 36 * ROUND(5.0f*R) + 6 * ROUND(5.0f*G) + ROUND(5.0f*B), ch); // color
data/jp2a-1.1.0/src/image.c:193:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
						fprintf(f, "\x1b[%d;2;%d;%d;%dm" PRINTF_FORMAT_TYPE, type, ROUND(255.0f*Y), ROUND(255.0f*Y), ROUND(255.0f*Y), ch);
data/jp2a-1.1.0/src/image.c:197:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
						fprintf(f, "\x1b[%d;2;%d;%d;%dm" PRINTF_FORMAT_TYPE, type, ROUND(255.0f*R), ROUND(255.0f*G), ROUND(255.0f*B), ch); // color
data/jp2a-1.1.0/src/image.c:319:3:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		fprintf(f, !use_border? "%s\n" : "|%s|\n", line);
data/jp2a-1.1.0/src/image.c:323:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(f, !use_border? "%s\n" : "|%s|\n", line);
data/jp2a-1.1.0/src/image.c:325:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(f, !use_border? "%s\n" : "|%s|\n", line + curLinePos);
data/jp2a-1.1.0/src/options.c:202:39:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
	#define IF_VARS(format, v1, v2) if ( sscanf(s, format, v1, v2) == 2 )
data/jp2a-1.1.0/src/options.c:203:39:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
	#define IF_VAR(format, v1)      if ( sscanf(s, format, v1) == 1 )
data/jp2a-1.1.0/src/options.c:304: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(ascii_palette, s+8);
data/jp2a-1.1.0/src/options.c:221:22:  [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.
			char *colorterm = getenv("COLORTERM");
data/jp2a-1.1.0/src/terminal.c:46:19:  [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.
	char *termtype = getenv("TERM");
data/jp2a-1.1.0/src/terminal.c:108:20:  [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.
	char *colorterm = getenv("COLORTERM");
data/jp2a-1.1.0/src/html.c:145: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 s[2];
data/jp2a-1.1.0/src/html.c:185: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 tempString[2];
data/jp2a-1.1.0/src/image.c: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 bord[width + 3];
data/jp2a-1.1.0/src/image.c:119:4:  [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 ch[MB_LEN_MAX + 1];
data/jp2a-1.1.0/src/image.c:277: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 line[image->width + 1];
data/jp2a-1.1.0/src/image.c:284: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 line[image->width * MB_LEN_MAX + 1];
data/jp2a-1.1.0/src/image.c:388: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 s[BARLEN];
data/jp2a-1.1.0/src/image.c:729: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 header[number_bytes_to_check];
data/jp2a-1.1.0/src/jp2a.c:62: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).
		if ( (fout = fopen(fileout, "wb")) == NULL ) {
data/jp2a-1.1.0/src/jp2a.c:163: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).
		if ( (fp = fopen(argv[n], "rb")) != NULL ) {
data/jp2a-1.1.0/src/jp2a.c:232:2:  [2] (buffer) TCHAR:
  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.
	TCHAR temp_path[1024];
data/jp2a-1.1.0/src/jp2a.c:236:2:  [2] (buffer) TCHAR:
  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.
	TCHAR temp_file_name[MAX_PATH];
data/jp2a-1.1.0/src/options.c:78: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 ascii_palette[ASCII_PALETTE_SIZE + 1] = ASCII_PALETTE_DEFAULT;
data/jp2a-1.1.0/src/options.c:80: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 ascii_palette[ASCII_PALETTE_SIZE * MB_LEN_MAX + 1] = ASCII_PALETTE_DEFAULT;
data/jp2a-1.1.0/src/options.c:81: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 ascii_palette_indizes[ASCII_PALETTE_SIZE] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22};
data/jp2a-1.1.0/src/options.c:82: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 ascii_palette_lengths[ASCII_PALETTE_SIZE] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
data/jp2a-1.1.0/src/terminal.c:43: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 errstr[1024];
data/jp2a-1.1.0/src/terminal.c:47: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 term_buffer[2048];
data/jp2a-1.1.0/src/terminal.c:61:3:  [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(errstr, "Could not determine console window size.");
data/jp2a-1.1.0/src/terminal.c:70:3:  [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(errstr, "Environment variable TERM not set.");
data/jp2a-1.1.0/src/terminal.c:89:3:  [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(errstr, "Could not access the termcap database.");
data/jp2a-1.1.0/src/terminal.c:101: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(errstr, "Compiled without termlib support.");
data/jp2a-1.1.0/src/html.c:165: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(html_title_raw)==0 ) {
data/jp2a-1.1.0/src/html.c:168:22:  [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).
	html_title = calloc(strlen(html_title_raw)*6 +1, sizeof(char)); // at most
data/jp2a-1.1.0/src/html.c:176:22:  [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 (int i = 0; i < strlen(html_title_raw); i++) {
data/jp2a-1.1.0/src/html.c:190: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).
		sizeNew = strlen(newChar);
data/jp2a-1.1.0/src/jp2a.c:142: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 urllen = strlen(argv[n]);
data/jp2a-1.1.0/src/jp2a.c:167: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).
			int namelen = strlen(argv[n]);
data/jp2a-1.1.0/src/options.c:288: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).
			if ( strlen(s)-8 > ASCII_PALETTE_SIZE ) {
data/jp2a-1.1.0/src/options.c:295: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).
			if ( strlen(s)-8 > ASCII_PALETTE_SIZE * MB_LEN_MAX ) {
data/jp2a-1.1.0/src/options.c:306: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).
			ascii_palette_length = strlen(ascii_palette);

ANALYSIS SUMMARY:

Hits = 48
Lines analyzed = 2772 in approximately 0.10 seconds (27858 lines/second)
Physical Source Lines of Code (SLOC) = 1836
Hits@level = [0]  69 [1]   9 [2]  22 [3]   3 [4]  14 [5]   0
Hits@level+ = [0+] 117 [1+]  48 [2+]  39 [3+]  17 [4+]  14 [5+]   0
Hits/KSLOC@level+ = [0+] 63.7255 [1+] 26.1438 [2+] 21.2418 [3+] 9.25926 [4+] 7.62527 [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.