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/ncompress-4.2.4.6/patchlevel.h
Examining data/ncompress-4.2.4.6/compress42.c

FINAL RESULTS:

data/ncompress-4.2.4.6/compress42.c:187:10:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
#	define	chmod(pathname, mode) 0
data/ncompress-4.2.4.6/compress42.c:188:10:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
#	define	chown(pathname, owner, group) 0
data/ncompress-4.2.4.6/compress42.c:1193:10:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
					if (chmod(ofname, infstat.st_mode & 07777))		/* Copy modes */
data/ncompress-4.2.4.6/compress42.c:1199:10:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
					if (chown(ofname, infstat.st_uid, infstat.st_gid))	/* Copy ownership */
data/ncompress-4.2.4.6/compress42.c:208:15:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
static inline access(const char *pathname, int mode)
data/ncompress-4.2.4.6/compress42.c:931: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(tempname,fileptr);
data/ncompress-4.2.4.6/compress42.c:1060:9:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
				if (access(ofname, F_OK) == 0)
data/ncompress-4.2.4.6/compress42.c:1316:4:  [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(fptr, dp->d_name);
data/ncompress-4.2.4.6/compress42.c:194: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).
#	define open _open
data/ncompress-4.2.4.6/compress42.c:818:17:  [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).
						maxbits = atoi(*argv);
data/ncompress-4.2.4.6/compress42.c:949:7:  [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(&tempname[namesize], ".Z", 3);
data/ncompress-4.2.4.6/compress42.c:1048: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(ofname, tempname, namesize);
data/ncompress-4.2.4.6/compress42.c:1049:5:  [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(&ofname[namesize], ".Z");
data/ncompress-4.2.4.6/compress42.c:1052:19:  [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 ((fdin = open(ifname = tempname, O_RDONLY|O_BINARY)) == -1)
data/ncompress-4.2.4.6/compress42.c:1107:21:  [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 ((fdout = open(ofname, O_WRONLY|O_CREAT|O_EXCL|O_BINARY,0600)) == -1)
data/ncompress-4.2.4.6/compress42.c:1269:3:  [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(nptr, dir, dir_size);
data/ncompress-4.2.4.6/compress42.c:1459: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(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1);
data/ncompress-4.2.4.6/compress42.c:1780:9:  [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(outbuf+outpos, stackp, i);
data/ncompress-4.2.4.6/compress42.c:1797:7:  [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(outbuf+outpos, stackp, i);
data/ncompress-4.2.4.6/compress42.c:196:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
#	define read _read
data/ncompress-4.2.4.6/compress42.c:921:29:  [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).
		unsigned long	 namesize = strlen(fileptr);
data/ncompress-4.2.4.6/compress42.c:1073:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			    			if (read(0, inbuf, 1) > 0)
data/ncompress-4.2.4.6/compress42.c:1079:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
										if (read(0, inbuf+1, 1) <= 0)
data/ncompress-4.2.4.6/compress42.c:1258: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).
		unsigned long			 dir_size = strlen(dir);
data/ncompress-4.2.4.6/compress42.c:1303: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).
			if (size < dir_size + strlen(dp->d_name) + 2)
data/ncompress-4.2.4.6/compress42.c:1305: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).
				size = dir_size + strlen(dp->d_name) + 2;
data/ncompress-4.2.4.6/compress42.c:1386:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while ((rsize = read(fdin, inbuf, IBUFSIZ)) > 0)
data/ncompress-4.2.4.6/compress42.c:1619:33:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while (insize < 3 && (rsize = read(fdin, inbuf+insize, IBUFSIZ)) > 0)
data/ncompress-4.2.4.6/compress42.c:1687:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				if ((rsize = read(fdin, inbuf+insize, IBUFSIZ)) < 0)

ANALYSIS SUMMARY:

Hits = 29
Lines analyzed = 1930 in approximately 0.08 seconds (23569 lines/second)
Physical Source Lines of Code (SLOC) = 1419
Hits@level = [0]  55 [1]  10 [2]  11 [3]   0 [4]   4 [5]   4
Hits@level+ = [0+]  84 [1+]  29 [2+]  19 [3+]   8 [4+]   8 [5+]   4
Hits/KSLOC@level+ = [0+] 59.1966 [1+] 20.4369 [2+] 13.3897 [3+] 5.63777 [4+] 5.63777 [5+] 2.81889
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.