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/liblockfile-1.16/acconfig.h
Examining data/liblockfile-1.16/dotlockfile.c
Examining data/liblockfile-1.16/lockfile.c
Examining data/liblockfile-1.16/lockfile.h
Examining data/liblockfile-1.16/nfslock.c

FINAL RESULTS:

data/liblockfile-1.16/dotlockfile.c:117: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(buf, fn);
data/liblockfile-1.16/dotlockfile.c:146:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(buf, "%s.lock", e);
data/liblockfile-1.16/dotlockfile.c:151:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(buf, "%s%s.lock", MAILDIR, user);
data/liblockfile-1.16/dotlockfile.c:414: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(cmd[0], cmd);
data/liblockfile-1.16/lockfile.c:145:3:  [4] (shell) execl:
  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.
		execl(LOCKPROG, LOCKPROG, opt, "-r", buf, "-q",
data/liblockfile-1.16/lockfile.c:209: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(tmplock, lockfile);
data/liblockfile-1.16/lockfile.c:523:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(mlockfile, "%s%s.lock", MAILDIR, name);
data/liblockfile-1.16/lockfile.c:548:4:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
			sprintf(mlockfile, "%s.lock", mail);
data/liblockfile-1.16/nfslock.c:145: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(s, pidstr);
data/liblockfile-1.16/nfslock.c:176:3:  [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(tmp, file);
data/liblockfile-1.16/dotlockfile.c:40:12:  [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.
extern int getopt();
data/liblockfile-1.16/dotlockfile.c:141: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.
	e = getenv("MAIL");
data/liblockfile-1.16/dotlockfile.c:212:14:  [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 ((c = getopt(argc, argv, "+qpNr:mluct")) != EOF) switch(c) {
data/liblockfile-1.16/lockfile.c:524:14:  [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 ((mail = getenv("MAIL")) != NULL) {
data/liblockfile-1.16/dotlockfile.c:223:14:  [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).
			retries = atoi(optarg);
data/liblockfile-1.16/dotlockfile.c:311:12:  [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).
		cwd_fd = open(".", O_PATH|O_CLOEXEC);
data/liblockfile-1.16/dotlockfile.c:313:12:  [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).
		cwd_fd = open(".", O_RDONLY|O_CLOEXEC);
data/liblockfile-1.16/lockfile.c:80: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		tmp[1024];
data/liblockfile-1.16/lockfile.c:115: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		buf[8];
data/liblockfile-1.16/lockfile.c:182: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		sysname[256];
data/liblockfile-1.16/lockfile.c:235: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		pidbuf[40];
data/liblockfile-1.16/lockfile.c:265: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(tmplock, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0644);
data/liblockfile-1.16/lockfile.c:410: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		buf[16];
data/liblockfile-1.16/lockfile.c:423:12:  [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).
	if ((fd = open(lockfile, O_RDONLY)) >= 0) {
data/liblockfile-1.16/lockfile.c:438:10:  [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).
			pid = atoi(buf);
data/liblockfile-1.16/nfslock.c:40: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 dir[1024];
data/liblockfile-1.16/nfslock.c:121:7:  [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).
		if (atoi(s+1) == getpid())
data/liblockfile-1.16/nfslock.c:133: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 pidstr[6];
data/liblockfile-1.16/nfslock.c:148:5:  [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).
int open(const char *file, int flags, ...)
data/liblockfile-1.16/nfslock.c:150: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 tmp[1024];
data/liblockfile-1.16/nfslock.c:182:3:  [2] (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). Risk is low because the source is a constant string.
		strcpy(s, ".nfs");
data/liblockfile-1.16/nfslock.c:231:9:  [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).
	return open(file, O_CREAT|O_WRONLY|O_TRUNC, mode);
data/liblockfile-1.16/dotlockfile.c:114:25:  [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).
	buf = (char *) malloc (strlen (fn) + 1);
data/liblockfile-1.16/dotlockfile.c:143: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).
		buf = (char *)malloc(strlen(e)+6);
data/liblockfile-1.16/dotlockfile.c:148: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).
		buf = (char *)malloc(strlen(MAILDIR)+strlen(user)+6);
data/liblockfile-1.16/dotlockfile.c:148: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).
		buf = (char *)malloc(strlen(MAILDIR)+strlen(user)+6);
data/liblockfile-1.16/dotlockfile.c:292: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(lockfile) >= MAXPATHLEN) {
data/liblockfile-1.16/lockfile.c:84:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(tmp, lockfile, sizeof(tmp) - 1);
data/liblockfile-1.16/lockfile.c:101: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 character.
		strncpy(tmp, ".", sizeof(tmp));
data/liblockfile-1.16/lockfile.c:173:23:  [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).
#define TMPLOCKSTRSZ		strlen(TMPLOCKSTR)
data/liblockfile-1.16/lockfile.c:189: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(lockfile) + TMPLOCKFILENAMESZ > MAXPATHLEN) {
data/liblockfile-1.16/lockfile.c:195: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(lockfile) + TMPLOCKFILENAMESZ + 1 > tmplocksz) {
data/liblockfile-1.16/lockfile.c:382: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).
	l = strlen(lockfile)+TMPLOCKFILENAMESZ+1;
data/liblockfile-1.16/lockfile.c:431:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		    (len = read(fd, buf, sizeof(buf))) >= 0 &&
data/liblockfile-1.16/lockfile.c:508: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(name) + sizeof(MAILDIR) + 6 > MAXPATHLEN) {
data/liblockfile-1.16/lockfile.c:519: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(name)+strlen(MAILDIR)+6;
data/liblockfile-1.16/lockfile.c:519:21:  [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(name)+strlen(MAILDIR)+6;
data/liblockfile-1.16/lockfile.c:530: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).
			newlen = strlen(mail)+6;
data/liblockfile-1.16/nfslock.c:44:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(dir, file, sizeof(dir));
data/liblockfile-1.16/nfslock.c:48:3:  [1] (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). Risk is low because the source is a constant character.
		strcpy(dir, ".");
data/liblockfile-1.16/nfslock.c:103: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(p);
data/liblockfile-1.16/nfslock.c:172: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(file) > sizeof(tmp) - 16) {

ANALYSIS SUMMARY:

Hits = 52
Lines analyzed = 1302 in approximately 0.08 seconds (15793 lines/second)
Physical Source Lines of Code (SLOC) = 868
Hits@level = [0]  12 [1]  20 [2]  18 [3]   4 [4]  10 [5]   0
Hits@level+ = [0+]  64 [1+]  52 [2+]  32 [3+]  14 [4+]  10 [5+]   0
Hits/KSLOC@level+ = [0+] 73.7327 [1+] 59.9078 [2+] 36.8664 [3+] 16.129 [4+] 11.5207 [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.