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/bup-0.31/lib/bup/bupsplit.c
Examining data/bup-0.31/lib/bup/bupsplit.h
Examining data/bup-0.31/lib/bup/_helpers.c

FINAL RESULTS:

data/bup-0.31/lib/bup/_helpers.c:1193:5:  [3] (random) srandom:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srandom(seed);
data/bup-0.31/lib/bup/_helpers.c:1199:26:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	    buf[i] = (uint32_t) random();
data/bup-0.31/lib/bup/_helpers.c:1215:26:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	    buf[i] = (uint32_t) random();
data/bup-0.31/lib/bup/_helpers.c:1237:2:  [3] (random) srandom:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	srandom((unsigned int) time(NULL));
data/bup-0.31/lib/bup/_helpers.c:1246:25:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	shabuf[i] = (uint32_t) random();
data/bup-0.31/lib/bup/_helpers.c:2448:9:  [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.
    e = getenv("BUP_FORCE_TTY");
data/bup-0.31/lib/bup/bupsplit.c:129:5:  [3] (random) srandom:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srandom(1);
data/bup-0.31/lib/bup/bupsplit.c:131:15:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	buf[count] = random();
data/bup-0.31/lib/bup/_helpers.c:343: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(buf, bufx + bufx_ofs, bufx_n);
data/bup-0.31/lib/bup/_helpers.c:344: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(buf + bufx_n, bufy + bufy_ofs, bufy_n);
data/bup-0.31/lib/bup/_helpers.c:733: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(&high, buf, 4);
data/bup-0.31/lib/bup/_helpers.c:748: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(&high, buf, 4);
data/bup-0.31/lib/bup/_helpers.c:902: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.
    unsigned char bytes[20];
data/bup-0.31/lib/bup/_helpers.c:1041: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(sha_ptr++, idx->cur, sizeof(struct sha));
data/bup-0.31/lib/bup/_helpers.c:1109: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 (fmap.buf, idx_header, sizeof(idx_header) - 1);
data/bup-0.31/lib/bup/_helpers.c:1151:6:  [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(sha_ptr++, sha, sizeof(struct sha));
data/bup-0.31/lib/bup/_helpers.c:1265: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).
    fd = open(filename, attrs_noatime);
data/bup-0.31/lib/bup/_helpers.c:1273: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).
	fd = open(filename, attrs);
data/bup-0.31/lib/bup/_helpers.c:1368: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).
    fd = open(path, O_RDONLY | O_NONBLOCK | O_LARGEFILE | O_NOFOLLOW);
data/bup-0.31/lib/bup/_helpers.c:1493:35:  [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 int bup_parse_xutimes_args(char **path,
data/bup-0.31/lib/bup/_helpers.c:1886:5:  [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[HOST_NAME_MAX + 1] = {};
data/bup-0.31/lib/bup/_helpers.c:1889:5:  [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[256] = {};
data/bup-0.31/lib/bup/_helpers.c:1910: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(result, buf, length);
data/bup-0.31/lib/bup/_helpers.c:2449: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).
    get_state(m)->istty2 = isatty(2) || (atoi(e ? e : "0") & 2);
data/bup-0.31/lib/bup/_helpers.c:371: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).
	if (argv[i] + strlen(argv[i]) + 1 != argv[i+1])
data/bup-0.31/lib/bup/_helpers.c:379: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).
    arge = argv[argc-1] + strlen(argv[argc-1]) + 1;
data/bup-0.31/lib/bup/_helpers.c:381:59:  [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 (strstr(argv[0], "python") && argv[1] == argv[0] + strlen(argv[0]) + 1)

ANALYSIS SUMMARY:

Hits = 27
Lines analyzed = 2699 in approximately 0.19 seconds (14426 lines/second)
Physical Source Lines of Code (SLOC) = 2157
Hits@level = [0]  10 [1]   3 [2]  16 [3]   8 [4]   0 [5]   0
Hits@level+ = [0+]  37 [1+]  27 [2+]  24 [3+]   8 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 17.1535 [1+] 12.5174 [2+] 11.1266 [3+] 3.70885 [4+]   0 [5+]   0
Symlinks skipped = 1 (--allowlink overrides but see doc for security issue)
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.