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/libpam-chroot-0.9/pam_chroot.c

FINAL RESULTS:

data/libpam-chroot-0.9/pam_chroot.c:703:13:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
		} else if(chroot(opts->chroot_dir) != 0) {
data/libpam-chroot-0.9/pam_chroot.c:245: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 scratch[SCRATCH];
data/libpam-chroot-0.9/pam_chroot.c:402:4:  [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(pos, user, reflen);
data/libpam-chroot-0.9/pam_chroot.c:410:4:  [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(pos, grp, reflen);
data/libpam-chroot-0.9/pam_chroot.c:428: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 (pos, match + matchptr[refnum].rm_so, reflen);
data/libpam-chroot-0.9/pam_chroot.c:467: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 conf_line[LINELEN];
data/libpam-chroot-0.9/pam_chroot.c:477: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(!(conf = fopen(opts->conf, "r"))) {
data/libpam-chroot-0.9/pam_chroot.c:397: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).
			reflen = strlen(user);
data/libpam-chroot-0.9/pam_chroot.c:398:31:  [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).
			exp = (char*) realloc(exp, strlen(exp) + reflen - 1);
data/libpam-chroot-0.9/pam_chroot.c:401:35:  [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).
			memmove(pos + reflen, pos + 2, strlen(pos + 2) + 1);
data/libpam-chroot-0.9/pam_chroot.c:405: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).
			reflen = strlen(grp);
data/libpam-chroot-0.9/pam_chroot.c:406:31:  [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).
			exp = (char*) realloc(exp, strlen(exp) + reflen - 1);
data/libpam-chroot-0.9/pam_chroot.c:409:35:  [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).
			memmove(pos + reflen, pos + 2, strlen(pos + 2) + 1);
data/libpam-chroot-0.9/pam_chroot.c:424:32:  [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).
				exp = (char*) realloc(exp, strlen(exp) + reflen + 1);
data/libpam-chroot-0.9/pam_chroot.c:427:36:  [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).
				memmove(pos + reflen, pos + 2, strlen(pos + 2) + 1);
data/libpam-chroot-0.9/pam_chroot.c:438:26:  [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).
			memmove(pos, pos + 1, strlen(pos) + 1);

ANALYSIS SUMMARY:

Hits = 16
Lines analyzed = 896 in approximately 0.04 seconds (20882 lines/second)
Physical Source Lines of Code (SLOC) = 738
Hits@level = [0]   1 [1]   9 [2]   6 [3]   1 [4]   0 [5]   0
Hits@level+ = [0+]  17 [1+]  16 [2+]   7 [3+]   1 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 23.0352 [1+] 21.6802 [2+] 9.48509 [3+] 1.35501 [4+]   0 [5+]   0
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.