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/bcal-2.2/inc/dslib.h
Examining data/bcal-2.2/inc/log.h
Examining data/bcal-2.2/src/bcal.c

FINAL RESULTS:

data/bcal-2.2/inc/log.h:34:103:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
static void debug_log(const char *func, int level, const char *format, ...) __attribute__((__format__(printf, 3, 4)));
data/bcal-2.2/src/bcal.c:101:4:  [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, format, ap);
data/bcal-2.2/src/bcal.c:104:4:  [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, format, ap);
data/bcal-2.2/src/bcal.c:211:9:  [4] (shell) execlp:
  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.
		ret = execlp(ptr, ptr, (char*) NULL);
data/bcal-2.2/src/bcal.c:2031:6:  [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.
	if (getenv("BCAL_USE_CALC"))
data/bcal-2.2/src/bcal.c:2037:16:  [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.
	while ((opt = getopt(argc, argv, "bc:df:hms:")) != -1) {
data/bcal-2.2/inc/dslib.h:10: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 p[NUM_LEN];
data/bcal-2.2/src/bcal.c:81:8:  [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 prompt[8] = "bcal> ";
data/bcal-2.2/src/bcal.c:83:8:  [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 uint_buf[UINT_BUF_LEN];
data/bcal-2.2/src/bcal.c:84:8:  [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 float_buf[FLOAT_BUF_LEN];
data/bcal-2.2/src/bcal.c:258: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 buffer[128];
data/bcal-2.2/src/bcal.c:305: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 binstr[MAX_BITS + 1] = {0};
data/bcal-2.2/src/bcal.c:126: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).
	len = strlen(src) + 1;
data/bcal-2.2/src/bcal.c:230: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).
		ret = (ssize_t)strlen(lastres.p);
data/bcal-2.2/src/bcal.c:247: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).
	ret = (ssize_t)strlen(expr);
data/bcal-2.2/src/bcal.c:260:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(pipe_cp[0], buffer, sizeof(buffer) - 1);
data/bcal-2.2/src/bcal.c:378: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(token) > 2 && token[0] == '0' &&
data/bcal-2.2/src/bcal.c:393: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(token) > 2 && token[0] == '0' &&
data/bcal-2.2/src/bcal.c:1446: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(arg.p) == 1 && !isdigit((int)arg.p[0])) {
data/bcal-2.2/src/bcal.c:1665: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).
	int len = (int)strlen(s) - 1;
data/bcal-2.2/src/bcal.c:1724:39:  [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 *parsed = (char *)calloc(1, 2 * strlen(exp) * sizeof(char));
data/bcal-2.2/src/bcal.c:1821: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).
		int unitchars = 0, len = (int)strlen(value);
data/bcal-2.2/src/bcal.c:2083:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
				strncpy(prompt, "calc> ", 7);
data/bcal-2.2/src/bcal.c:2085:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
				strncpy(prompt, "bc> ", 5);
data/bcal-2.2/src/bcal.c:2142: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(tmp) == 1) && tmp[1] == '\0') {
data/bcal-2.2/src/bcal.c:2161:8:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
							strncpy(prompt, "calc> ", 7);
data/bcal-2.2/src/bcal.c:2164:8:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
							strncpy(prompt, "bc> ", 5);
data/bcal-2.2/src/bcal.c:2167:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
						strncpy(prompt, "bcal> ", 7);

ANALYSIS SUMMARY:

Hits = 28
Lines analyzed = 2422 in approximately 0.07 seconds (36796 lines/second)
Physical Source Lines of Code (SLOC) = 1791
Hits@level = [0]  92 [1]  16 [2]   6 [3]   2 [4]   4 [5]   0
Hits@level+ = [0+] 120 [1+]  28 [2+]  12 [3+]   6 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 67.0017 [1+] 15.6337 [2+] 6.70017 [3+] 3.35008 [4+] 2.23339 [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.