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/bar-1.11.1/io.c
Examining data/bar-1.11.1/error.c
Examining data/bar-1.11.1/args.h
Examining data/bar-1.11.1/display.h
Examining data/bar-1.11.1/test-001-pre.c
Examining data/bar-1.11.1/error.h
Examining data/bar-1.11.1/fd.c
Examining data/bar-1.11.1/io.h
Examining data/bar-1.11.1/bar.c
Examining data/bar-1.11.1/display.c
Examining data/bar-1.11.1/types.h
Examining data/bar-1.11.1/test-001-post.c
Examining data/bar-1.11.1/args.c
Examining data/bar-1.11.1/fd.h
Examining data/bar-1.11.1/test-types.c
Examining data/bar-1.11.1/headers.h

FINAL RESULTS:

data/bar-1.11.1/args.c:1109:7:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
		if (chmod(str,st.st_mode) != 0) {
data/bar-1.11.1/args.c:11:25:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
#	error *** ERROR: This system does not have sprintf()
data/bar-1.11.1/args.c:11:46:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
#	error *** ERROR: This system does not have sprintf()
data/bar-1.11.1/args.c:655:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(option_buffer, "[ %s%s%s%s%s ]",
data/bar-1.11.1/args.c:683:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(option_buffer, "[ %s%s%s%s%s ]",
data/bar-1.11.1/args.c:1081:8:  [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).
			if (strcpy(str,value) == 0) {
data/bar-1.11.1/args.c:1089:8:  [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).
			if (strcat(str,basename) == 0) {
data/bar-1.11.1/args.c:3044: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(filename, F_OK) != 0)
data/bar-1.11.1/args.c:3136: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("/etc/clpbarrc", R_OK) == 0) {
data/bar-1.11.1/error.c:22:8:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
	(void)vsprintf(msg, fmt, ap);
data/bar-1.11.1/error.c:39:8:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
	(void)vsprintf(msg, fmt, ap);
data/bar-1.11.1/args.c:3143:13:  [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_dir = getenv("HOME");
data/bar-1.11.1/args.c:640: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 option_buffer[256];
data/bar-1.11.1/args.c:1032:11:  [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).
		io.in = open(value, O_RDONLY
data/bar-1.11.1/args.c:1064: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 str[4096] = { 0 };
data/bar-1.11.1/args.c:1098:12:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
		io.out = open(value, O_WRONLY|O_CREAT
data/bar-1.11.1/args.c:1275: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 check[4096] = { 0 };
data/bar-1.11.1/args.c:1278:2:  [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(check, "%d", n);
data/bar-1.11.1/args.c:1315: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 check[4096] = { 0 };
data/bar-1.11.1/args.c:1318:2:  [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(check, "%lu", n);
data/bar-1.11.1/args.c:1751:2:  [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(d.title, "%.*s", 80, argv[(*arg_num)+1]);
data/bar-1.11.1/args.c:1758:2:  [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(d.title, "%.*s", 80, value);
data/bar-1.11.1/args.c:3038: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 tag[80];
data/bar-1.11.1/args.c:3039: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 value[80];
data/bar-1.11.1/args.c:3047:11:  [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).
	rcfile = fopen(filename, "r");
data/bar-1.11.1/args.c:3133: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 filename[4096] = { 0 };
data/bar-1.11.1/args.c:3137: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(filename, "/etc/clpbarrc");
data/bar-1.11.1/args.c:3145: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(filename, "%.*s/.barrc", 4088, home_dir);
data/bar-1.11.1/args.c:3150:2:  [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(filename, "./.barrc");
data/bar-1.11.1/display.c:166: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).
	d.info_fin = fopen(d.info_file, "r");
data/bar-1.11.1/display.c:186: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).
	d.info_fin = fopen(d.info_file, "r");
data/bar-1.11.1/display.h:42: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 title[81];
data/bar-1.11.1/display.h:84: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 info_line[256];
data/bar-1.11.1/error.c:19: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 msg[256] = { 0 };
data/bar-1.11.1/error.c:36: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 msg[256] = { 0 };
data/bar-1.11.1/test-001-post.c:8: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[1024] = { 0 };
data/bar-1.11.1/args.c:662: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 (d.screen_width - screen_used < strlen(option_buffer)) {
data/bar-1.11.1/args.c:667: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).
		screen_used += strlen(option_buffer);
data/bar-1.11.1/args.c:690: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 (d.screen_width - screen_used < strlen(option_buffer)) {
data/bar-1.11.1/args.c:695: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).
		screen_used += strlen(option_buffer);
data/bar-1.11.1/args.c:816: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(s) == 0)
data/bar-1.11.1/args.c:850: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(s) == 0)
data/bar-1.11.1/args.c:875:20:  [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).
		num_whole_part = strlen(s);
data/bar-1.11.1/args.c:1074:28:  [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).
			basename = io.in_path + strlen(io.in_path);
data/bar-1.11.1/args.c:1085:8:  [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.
			if (strcat(str,"/") == 0) {
data/bar-1.11.1/args.c:3061:8:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ch = fgetc(rcfile);
data/bar-1.11.1/args.c:3067:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				ch = fgetc(rcfile);
data/bar-1.11.1/args.c:3072: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).
			tag[strlen(tag)] = ch;
data/bar-1.11.1/args.c:3073:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ch = fgetc(rcfile);
data/bar-1.11.1/args.c:3087: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(tag) == 0) {
data/bar-1.11.1/args.c:3098:8:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ch = fgetc(rcfile);
data/bar-1.11.1/args.c:3100:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ch = fgetc(rcfile);
data/bar-1.11.1/args.c:3108: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).
			value[strlen(value)] = ch;
data/bar-1.11.1/args.c:3109:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ch = fgetc(rcfile);
data/bar-1.11.1/args.c:3117: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(value) == 0) {
data/bar-1.11.1/args.c:3139: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(filename) > 0)
data/bar-1.11.1/display.c:618: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).
		this_width = strlen(d.title);
data/bar-1.11.1/display.c:697: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).
	this_width = 11+strlen(time_title);
data/bar-1.11.1/io.c:249:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		num_read = read(io.in,
data/bar-1.11.1/io.c:254:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		num_read = read(io.in,
data/bar-1.11.1/test-001-post.c:14:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(in, buffer, strlen(expected));
data/bar-1.11.1/test-001-post.c:14: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).
	read(in, buffer, strlen(expected));
data/bar-1.11.1/test-001-post.c:21:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(in, buffer, strlen(expected));
data/bar-1.11.1/test-001-post.c:21: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).
	read(in, buffer, strlen(expected));
data/bar-1.11.1/test-001-pre.c:16: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).
	write(out, buffer, strlen(buffer));
data/bar-1.11.1/test-001-pre.c:18: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).
	write(out, buffer, strlen(buffer));

ANALYSIS SUMMARY:

Hits = 66
Lines analyzed = 5158 in approximately 0.16 seconds (33009 lines/second)
Physical Source Lines of Code (SLOC) = 4387
Hits@level = [0]  78 [1]  30 [2]  24 [3]   1 [4]  10 [5]   1
Hits@level+ = [0+] 144 [1+]  66 [2+]  36 [3+]  12 [4+]  11 [5+]   1
Hits/KSLOC@level+ = [0+] 32.8243 [1+] 15.0444 [2+] 8.20606 [3+] 2.73535 [4+] 2.50741 [5+] 0.227946
Dot directories skipped = 1 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.