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/libnss-pgsql-1.4.0debian/src/nss-pgsql.h
Examining data/libnss-pgsql-1.4.0debian/src/config.c
Examining data/libnss-pgsql-1.4.0debian/src/libc-lock.h
Examining data/libnss-pgsql-1.4.0debian/src/util.c
Examining data/libnss-pgsql-1.4.0debian/src/interface.c
Examining data/libnss-pgsql-1.4.0debian/src/backend.c

FINAL RESULTS:

data/libnss-pgsql-1.4.0debian/src/config.c:95:6:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
		if(sscanf(line, " %s = %[^\n]", key, val) < 2) {
data/libnss-pgsql-1.4.0debian/src/config.c:104:6:  [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(_shadowoptions[h], val);
data/libnss-pgsql-1.4.0debian/src/config.c:111:6:  [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(_options[h], val);
data/libnss-pgsql-1.4.0debian/src/util.c:23: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, msg, ap);
data/libnss-pgsql-1.4.0debian/src/util.c:35: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, msg, ap);
data/libnss-pgsql-1.4.0debian/src/backend.c:269: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 *token[end+1];
data/libnss-pgsql-1.4.0debian/src/backend.c:313: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 *params[1];
data/libnss-pgsql-1.4.0debian/src/backend.c:604: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.
	const char *params[1];
data/libnss-pgsql-1.4.0debian/src/backend.c:630: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 *params[1];
data/libnss-pgsql-1.4.0debian/src/backend.c:666: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.
	const char *params[1];
data/libnss-pgsql-1.4.0debian/src/backend.c:695: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 *params[1];
data/libnss-pgsql-1.4.0debian/src/backend.c:729: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 *params[2];
data/libnss-pgsql-1.4.0debian/src/backend.c:757:20:  [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).
		groups[*start] = atoi(PQgetvalue(res, rows, 0));
data/libnss-pgsql-1.4.0debian/src/backend.c:787:33:  [2] (integer) atol:
  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).
	result->sp_lstchg = (long int) atol(PQgetvalue(res, 0, SHADOW_LSTCHG));
data/libnss-pgsql-1.4.0debian/src/backend.c:788:30:  [2] (integer) atol:
  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).
	result->sp_min = (long int) atol(PQgetvalue(res, 0, SHADOW_MIN));
data/libnss-pgsql-1.4.0debian/src/backend.c:789:30:  [2] (integer) atol:
  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).
	result->sp_max = (long int) atol(PQgetvalue(res, 0, SHADOW_MAX));
data/libnss-pgsql-1.4.0debian/src/backend.c:790:31:  [2] (integer) atol:
  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).
	result->sp_warn = (long int) atol(PQgetvalue(res, 0, SHADOW_WARN));
data/libnss-pgsql-1.4.0debian/src/backend.c:791:32:  [2] (integer) atol:
  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).
	result->sp_inact = (long int) atol(PQgetvalue(res, 0, SHADOW_INACT));
data/libnss-pgsql-1.4.0debian/src/backend.c:792:33:  [2] (integer) atol:
  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).
	result->sp_expire = (long int) atol(PQgetvalue(res, 0, SHADOW_EXPIRE));
data/libnss-pgsql-1.4.0debian/src/backend.c:793:40:  [2] (integer) atol:
  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).
	result->sp_flag = (unsigned long int) atol(PQgetvalue(res, 0, SHADOW_FLAG));
data/libnss-pgsql-1.4.0debian/src/backend.c:841: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.
	const char *params[1];
data/libnss-pgsql-1.4.0debian/src/config.c:20: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 *_options[HASHMAX];
data/libnss-pgsql-1.4.0debian/src/config.c:21: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 *_shadowoptions[HASHMAX];
data/libnss-pgsql-1.4.0debian/src/config.c:48: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 line[CFGLINEMAX], key[CFGLINEMAX], val[CFGLINEMAX], *c;
data/libnss-pgsql-1.4.0debian/src/config.c:77:12:  [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(!(cf = fopen(configfile, "r"))) {
data/libnss-pgsql-1.4.0debian/src/backend.c:209: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).
	slen = strlen(sptr);
data/libnss-pgsql-1.4.0debian/src/backend.c:214:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(*buffer, sptr, slen);
data/libnss-pgsql-1.4.0debian/src/backend.c:231: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).
	slen = strlen(sptr);
data/libnss-pgsql-1.4.0debian/src/backend.c:236:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(*buffer, sptr, slen);
data/libnss-pgsql-1.4.0debian/src/backend.c:264: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).
	end = strlen(sptr) - 1;
data/libnss-pgsql-1.4.0debian/src/config.c:103: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).
					_shadowoptions[h] = malloc(strlen(val)+1);
data/libnss-pgsql-1.4.0debian/src/config.c:110: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).
					_options[h] = malloc(strlen(val)+1);

ANALYSIS SUMMARY:

Hits = 32
Lines analyzed = 1487 in approximately 0.05 seconds (28475 lines/second)
Physical Source Lines of Code (SLOC) = 1106
Hits@level = [0]   4 [1]   7 [2]  20 [3]   0 [4]   5 [5]   0
Hits@level+ = [0+]  36 [1+]  32 [2+]  25 [3+]   5 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 32.5497 [1+] 28.9331 [2+] 22.604 [3+] 4.5208 [4+] 4.5208 [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.