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/scrounge-ntfs-0.9/config.win32.h
Examining data/scrounge-ntfs-0.9/src/compat.c
Examining data/scrounge-ntfs-0.9/src/compat.h
Examining data/scrounge-ntfs-0.9/src/debug.h
Examining data/scrounge-ntfs-0.9/src/drive.h
Examining data/scrounge-ntfs-0.9/src/list.c
Examining data/scrounge-ntfs-0.9/src/locks.h
Examining data/scrounge-ntfs-0.9/src/memref.h
Examining data/scrounge-ntfs-0.9/src/misc.c
Examining data/scrounge-ntfs-0.9/src/ntfs.c
Examining data/scrounge-ntfs-0.9/src/ntfs.h
Examining data/scrounge-ntfs-0.9/src/ntfsx.h
Examining data/scrounge-ntfs-0.9/src/ntfsx.c
Examining data/scrounge-ntfs-0.9/src/posix.c
Examining data/scrounge-ntfs-0.9/src/scrounge.c
Examining data/scrounge-ntfs-0.9/src/scrounge.h
Examining data/scrounge-ntfs-0.9/src/search.c
Examining data/scrounge-ntfs-0.9/src/unicode.c
Examining data/scrounge-ntfs-0.9/src/usuals.h
Examining data/scrounge-ntfs-0.9/src/win32.c
Examining data/scrounge-ntfs-0.9/src/main.c

FINAL RESULTS:

data/scrounge-ntfs-0.9/src/posix.c:100: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(filename, st.st_mode) == -1)
data/scrounge-ntfs-0.9/src/compat.c:198:3:  [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(err_file, fmt, ap);
data/scrounge-ntfs-0.9/src/compat.c:222:3:  [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(err_file, fmt, ap);
data/scrounge-ntfs-0.9/src/compat.c:258:3:  [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(err_file, fmt, ap);
data/scrounge-ntfs-0.9/src/compat.c:279:3:  [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(err_file, fmt, ap);
data/scrounge-ntfs-0.9/src/compat.h:255:32:  [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.
      #error Set for wide file access, but no wide open
data/scrounge-ntfs-0.9/src/compat.h:265:32:  [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.
      #error Set for wide file access but no wide chdir
data/scrounge-ntfs-0.9/src/compat.h:275:32:  [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.
      #error Set for wide file access but no wide mkdir
data/scrounge-ntfs-0.9/src/compat.h:285:32:  [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.
      #error Set for wide file access but no wide getcwd
data/scrounge-ntfs-0.9/src/compat.h:289:18:  [4] (buffer) wcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer.
  #define fcscpy wcscpy
data/scrounge-ntfs-0.9/src/compat.h:290:18:  [4] (buffer) wcscat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120).
  #define fcscat wcscat
data/scrounge-ntfs-0.9/src/compat.h:307:18:  [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).
  #define fcscpy strcpy
data/scrounge-ntfs-0.9/src/compat.h:309:18:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
  #define fcscat strcat
data/scrounge-ntfs-0.9/src/drive.h:65:7:  [4] (shell) system:
  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.
	byte system;		    /* partition type */
data/scrounge-ntfs-0.9/src/list.c:56:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		printf(kPrintNTFSInfo, boot->secPerClus, boot->offMFT * boot->secPerClus);
data/scrounge-ntfs-0.9/src/list.c:94:5:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
				printf(kPrintDriveInfo, (uint32)tblSector + mbr.partitions[i].startsec, (uint32)tblSector + mbr.partitions[i].endsec);
data/scrounge-ntfs-0.9/src/list.c:110:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf(kPrintData);
data/scrounge-ntfs-0.9/src/list.c:120:4:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			printf(kPrintDrive, i);
data/scrounge-ntfs-0.9/src/list.c:134:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf(kPrintData);
data/scrounge-ntfs-0.9/src/list.c:135:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  printf(kPrintDrivePath, drive);
data/scrounge-ntfs-0.9/src/scrounge.c:205:5:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    printf(flags & PROCESS_MFT_FLAG_SUB ? 
data/scrounge-ntfs-0.9/src/compat.c:74:5:  [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.
int getopt(int nargc, char* const* nargv, const char* ostr)
data/scrounge-ntfs-0.9/src/compat.h:170:5:  [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.
int getopt(int nargc, char* const* nargv, const char* ostr);
data/scrounge-ntfs-0.9/src/main.c:95:15:  [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((ch = getopt(argc, argv, "c:d:hlm:o:sv")) != -1)
data/scrounge-ntfs-0.9/src/main.c:97:15:  [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((ch = getopt(argc, argv, "c:hlm:o:sv")) != -1)
data/scrounge-ntfs-0.9/src/compat.c:32: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 prognamebuf[256];
data/scrounge-ntfs-0.9/src/compat.h:255:52:  [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).
      #error Set for wide file access, but no wide open
data/scrounge-ntfs-0.9/src/compat.h:302: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).
  #define fc_open open
data/scrounge-ntfs-0.9/src/list.c:106: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 driveName[MAX_PATH];
data/scrounge-ntfs-0.9/src/list.c:117: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).
    dd = open(driveName, O_BINARY | O_RDONLY | OPEN_LARGE_OPTS);
data/scrounge-ntfs-0.9/src/list.c:130: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).
  int dd = open(drive, O_BINARY | O_RDONLY | OPEN_LARGE_OPTS);
data/scrounge-ntfs-0.9/src/main.c:84: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 driveName[MAX_PATH + 1];
data/scrounge-ntfs-0.9/src/main.c:106:16:  [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).
        temp = atol(optarg);
data/scrounge-ntfs-0.9/src/main.c:121:16:  [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).
        temp = atol(optarg);
data/scrounge-ntfs-0.9/src/main.c:145:16:  [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).
        temp = atol(optarg);
data/scrounge-ntfs-0.9/src/main.c:220:12:  [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).
    temp = atol(argv[0]);
data/scrounge-ntfs-0.9/src/main.c:226:12:  [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).
    temp = atol(argv[1]);
data/scrounge-ntfs-0.9/src/main.c:233:17:  [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).
    pi.device = open(driveName, O_BINARY | O_RDONLY | OPEN_LARGE_OPTS);
data/scrounge-ntfs-0.9/src/misc.c:192: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 buf[COMPARE_BLOCK_SIZE];
data/scrounge-ntfs-0.9/src/ntfs.h: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 sysId[8];			  /* System Id: "NTFS    " */
data/scrounge-ntfs-0.9/src/ntfsx.c:86:2:  [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(&(dr->length), (dr->_curpos), length);
data/scrounge-ntfs-0.9/src/ntfsx.c:96:2:  [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(&offset, (dr->_curpos), roffset);
data/scrounge-ntfs-0.9/src/compat.c:44:42:  [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).
		temp = (temp > beg) ? temp : _pgmptr + strlen(_pgmptr);
data/scrounge-ntfs-0.9/src/compat.c:49:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(prognamebuf, beg, temp - beg);
data/scrounge-ntfs-0.9/src/compat.h:291:19:  [1] (buffer) wcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  #define fcsncpy wcsncpy
data/scrounge-ntfs-0.9/src/compat.h:292:18:  [1] (buffer) wcslen:
  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 fcslen wcslen
data/scrounge-ntfs-0.9/src/compat.h:308:19:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  #define fcsncpy strncpy
data/scrounge-ntfs-0.9/src/compat.h:310:18:  [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 fcslen strlen
data/scrounge-ntfs-0.9/src/list.c:47:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  sz = read(dd, &sector, kSectorSize);
data/scrounge-ntfs-0.9/src/list.c:76:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  sz = read(dd, &mbr, sizeof(drive_mbr));
data/scrounge-ntfs-0.9/src/main.c:202:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(driveName, argv[0], MAX_PATH);
data/scrounge-ntfs-0.9/src/misc.c:199:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    r = read(f, buf, num);
data/scrounge-ntfs-0.9/src/ntfsx.c:138:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  sz = read(dd, clus->data, clus->size);
data/scrounge-ntfs-0.9/src/scrounge.c:94:11:  [1] (buffer) wcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
          wcsncpy(basics->filename, name, len);
data/scrounge-ntfs-0.9/src/scrounge.c:98:17:  [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(temp);
data/scrounge-ntfs-0.9/src/scrounge.c:102:11:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
          strncpy(basics->filename, temp, len);
data/scrounge-ntfs-0.9/src/scrounge.c:639:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    sz = read(pi->device, buffSec, kSectorSize);

ANALYSIS SUMMARY:

Hits = 57
Lines analyzed = 4154 in approximately 0.10 seconds (42570 lines/second)
Physical Source Lines of Code (SLOC) = 2651
Hits@level = [0]  21 [1]  15 [2]  17 [3]   4 [4]  20 [5]   1
Hits@level+ = [0+]  78 [1+]  57 [2+]  42 [3+]  25 [4+]  21 [5+]   1
Hits/KSLOC@level+ = [0+] 29.4229 [1+] 21.5013 [2+] 15.8431 [3+] 9.4304 [4+] 7.92154 [5+] 0.377216
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.