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/pam-shield-0.9.6/pam_shield.c
Examining data/pam-shield-0.9.6/pam_shield.h
Examining data/pam-shield-0.9.6/shield_purge.c
Examining data/pam-shield-0.9.6/pam_shield_lib.h
Examining data/pam-shield-0.9.6/pam_shield_lib.c

FINAL RESULTS:

data/pam-shield-0.9.6/pam_shield_lib.c:176:2:  [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(n->name, name);
data/pam-shield-0.9.6/pam_shield_lib.c:712:3:  [4] (shell) execvp:
  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.
		execvp(argv[0], argv);
data/pam-shield-0.9.6/shield_purge.c:38:2:  [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, fmt, varargs);
data/pam-shield-0.9.6/shield_purge.c:80:15:  [3] (buffer) getopt_long:
  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_long(argc, argv, "hdc:nlf", long_options, NULL)) != -1) {
data/pam-shield-0.9.6/pam_shield.c:215: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 ipbuf[INET6_ADDRSTRLEN], *saddr;
data/pam-shield-0.9.6/pam_shield.c:333: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(record->ip.any, saddr, key.dsize);
data/pam-shield-0.9.6/pam_shield.h:18: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 any[1];			/* access to any */
data/pam-shield-0.9.6/pam_shield.h:38:12:  [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 any[1];
data/pam-shield-0.9.6/pam_shield.h:44:12:  [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 any[1];
data/pam-shield-0.9.6/pam_shield.h:56: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 name[1];
data/pam-shield-0.9.6/pam_shield_lib.c:90: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 addr[INET6_ADDRSTRLEN], mask[INET6_ADDRSTRLEN];
data/pam-shield-0.9.6/pam_shield_lib.c:128: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 addr1[INET_ADDRSTRLEN], addr2[INET_ADDRSTRLEN], mask[INET_ADDRSTRLEN];
data/pam-shield-0.9.6/pam_shield_lib.c:152: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 addr1[INET6_ADDRSTRLEN], addr2[INET6_ADDRSTRLEN], mask[INET6_ADDRSTRLEN];
data/pam-shield-0.9.6/pam_shield_lib.c:414:11:  [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).
			bits = atoi(netmask);
data/pam-shield-0.9.6/pam_shield_lib.c:443:11:  [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).
			bits = atoi(netmask);
data/pam-shield-0.9.6/pam_shield_lib.c:488: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 buf[MAX_LINE], *p, *endp;
data/pam-shield-0.9.6/pam_shield_lib.c:494: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).
	if ((f = fopen(conffile, "r")) == NULL) {
data/pam-shield-0.9.6/pam_shield_lib.c:685: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 ipbuf[INET6_ADDRSTRLEN];
data/pam-shield-0.9.6/pam_shield_lib.c:705: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 *argv[4];
data/pam-shield-0.9.6/pam_shield_lib.c:730: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 ipbuf[INET6_ADDRSTRLEN];
data/pam-shield-0.9.6/shield_purge.c:128: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 ipbuf[INET6_ADDRSTRLEN];
data/pam-shield-0.9.6/pam_shield.c:195: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 (strspn(rhost, "0123456789.") == strlen(rhost)
data/pam-shield-0.9.6/pam_shield.c:196:50:  [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).
		|| strspn(rhost, "0123456789:abcdefABCDEF") == strlen(rhost)) {
data/pam-shield-0.9.6/pam_shield.c:277:4:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
			usleep(1000);
data/pam-shield-0.9.6/pam_shield_lib.c:172:51:  [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 ((n = (name_list *)malloc(sizeof(name_list) + strlen(name))) == NULL)
data/pam-shield-0.9.6/pam_shield_lib.c:221: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(name) > strlen(n->name)) && !strcasecmp(n->name, name + strlen(name) - strlen(n->name))) {
data/pam-shield-0.9.6/pam_shield_lib.c:221:24:  [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(name) > strlen(n->name)) && !strcasecmp(n->name, name + strlen(name) - strlen(n->name))) {
data/pam-shield-0.9.6/pam_shield_lib.c:221:72:  [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(name) > strlen(n->name)) && !strcasecmp(n->name, name + strlen(name) - strlen(n->name))) {
data/pam-shield-0.9.6/pam_shield_lib.c:221:87:  [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(name) > strlen(n->name)) && !strcasecmp(n->name, name + strlen(name) - strlen(n->name))) {
data/pam-shield-0.9.6/pam_shield_lib.c:292: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).
		memmove(str, p, strlen(p)+1);
data/pam-shield-0.9.6/pam_shield_lib.c:294: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).
	i = strlen(str)-1;
data/pam-shield-0.9.6/pam_shield_lib.c:413:40:  [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 (strspn(netmask, "0123456789") == strlen(netmask)) {
data/pam-shield-0.9.6/pam_shield_lib.c:442:40:  [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 (strspn(netmask, "0123456789") == strlen(netmask)) {
data/pam-shield-0.9.6/pam_shield_lib.c:667:3:  [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(buf, "(null)", buflen);

ANALYSIS SUMMARY:

Hits = 34
Lines analyzed = 1629 in approximately 0.05 seconds (32033 lines/second)
Physical Source Lines of Code (SLOC) = 1086
Hits@level = [0]   8 [1]  13 [2]  17 [3]   1 [4]   3 [5]   0
Hits@level+ = [0+]  42 [1+]  34 [2+]  21 [3+]   4 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 38.674 [1+] 31.3076 [2+] 19.337 [3+] 3.68324 [4+] 2.76243 [5+]   0
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.