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/debianutils-4.11.2/ischroot.c
Examining data/debianutils-4.11.2/run-parts.c
Examining data/debianutils-4.11.2/tempfile.c

FINAL RESULTS:

data/debianutils-4.11.2/ischroot.c:236:18:  [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.
#warning unknown system, chroot detection will always fail
data/debianutils-4.11.2/run-parts.c:72: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(stderr, format, ap);
data/debianutils-4.11.2/run-parts.c:215:5:  [4] (shell) execv:
  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.
    execv(progname, args);
data/debianutils-4.11.2/run-parts.c:475: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(filename, dirname);
data/debianutils-4.11.2/run-parts.c:503:5:  [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(filename + dirname_length, namelist[i]->d_name);
data/debianutils-4.11.2/run-parts.c:505:5:  [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(filename, dirname);
data/debianutils-4.11.2/run-parts.c:507:5:  [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).
    strcat(filename, namelist[i]->d_name);
data/debianutils-4.11.2/run-parts.c:520:12:  [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(filename, X_OK)) {
data/debianutils-4.11.2/run-parts.c:525: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(filename, R_OK))
data/debianutils-4.11.2/run-parts.c:544:17:  [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.
      else if (!access(filename, R_OK)) {
data/debianutils-4.11.2/ischroot.c:47:25:  [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.
  return ((fakechroot = getenv("FAKECHROOT")) &&
data/debianutils-4.11.2/ischroot.c:49:13:  [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.
	  (NULL != getenv("FAKECHROOT_BASE")) &&
data/debianutils-4.11.2/ischroot.c:50:17:  [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.
	  (ldpreload = getenv("LD_PRELOAD")) &&
data/debianutils-4.11.2/ischroot.c:236:26:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
#warning unknown system, chroot detection will always fail
data/debianutils-4.11.2/ischroot.c:258:9:  [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.
    c = getopt_long(argc, argv, "fthV", long_options, &option_index);
data/debianutils-4.11.2/run-parts.c:394:11:  [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.
	tmpdir = getenv("TMPDIR");
data/debianutils-4.11.2/run-parts.c:599:9:  [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.
    c = getopt_long(argc, argv, "u:ha:vV", long_options, &option_index);
data/debianutils-4.11.2/tempfile.c:79:18:  [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 ((optc = getopt_long (argc, argv, "p:s:d:m:n:", long_options, 0))
data/debianutils-4.11.2/tempfile.c:133:2:  [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.
	getenv("TMPDIR"),
data/debianutils-4.11.2/ischroot.c:63: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 buf1[1024], buf2[1024];
data/debianutils-4.11.2/ischroot.c:68: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).
  fd1 = open("/proc/1/mountinfo", O_RDONLY);
data/debianutils-4.11.2/ischroot.c:69: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).
  fd2 = open("/proc/self/mountinfo", O_RDONLY);
data/debianutils-4.11.2/run-parts.c:227:5:  [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[4096];
data/debianutils-4.11.2/run-parts.c:399: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(tmpdir, O_TMPFILE|O_RDWR|O_EXCL, S_IRUSR | S_IWUSR);
data/debianutils-4.11.2/run-parts.c:412:7:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
	fd = mkstemp(tmpfile_path);
data/debianutils-4.11.2/run-parts.c:427: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 buffer[4096];
data/debianutils-4.11.2/tempfile.c:115:15:  [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(name, O_RDWR | O_CREAT | O_EXCL, mode)) < 0)
data/debianutils-4.11.2/ischroot.c:77:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rlen1 = read(fd1, buf1, sizeof(buf1));
data/debianutils-4.11.2/ischroot.c:78:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rlen2 = read(fd2, buf2, sizeof(buf2));
data/debianutils-4.11.2/run-parts.c:127:3:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
  umask(mask);
data/debianutils-4.11.2/run-parts.c:285:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	  c = read(pout[0], buf, sizeof(buf));
data/debianutils-4.11.2/run-parts.c:305:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	  c = read(perr[0], buf, sizeof(buf));
data/debianutils-4.11.2/run-parts.c:435:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    bytes = rest = read(STDIN_FILENO, buffer, sizeof(buffer));
data/debianutils-4.11.2/run-parts.c:468:20:  [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).
  dirname_length = strlen(dirname) + 1;
data/debianutils-4.11.2/run-parts.c:476:3:  [1] (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). Risk is low because the
  source is a constant character.
  strcat(filename, "/");
data/debianutils-4.11.2/run-parts.c:496:44:  [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 (filename_length < dirname_length + strlen(namelist[i]->d_name) + 1) {
data/debianutils-4.11.2/run-parts.c:497: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).
      filename_length = dirname_length + strlen(namelist[i]->d_name) + 1;
data/debianutils-4.11.2/run-parts.c:506:5:  [1] (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). Risk is low because the
  source is a constant character.
    strcat(filename, "/");
data/debianutils-4.11.2/run-parts.c:574:3:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
  umask(022);
data/debianutils-4.11.2/tempfile.c:146:2:  [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).
	strlen(tmpdir) + 1 + /* / */
data/debianutils-4.11.2/tempfile.c:147: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).
	(pfx ? strlen(pfx) : 0) +
data/debianutils-4.11.2/tempfile.c:149: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).
	(sfx ? strlen(sfx) : 0) +
data/debianutils-4.11.2/tempfile.c:160: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).
      if ((fd = mkstemps(filename, sfx ? strlen(sfx) : 0)) < 0) {

ANALYSIS SUMMARY:

Hits = 43
Lines analyzed = 1221 in approximately 0.10 seconds (12404 lines/second)
Physical Source Lines of Code (SLOC) = 928
Hits@level = [0]  28 [1]  16 [2]   8 [3]   9 [4]  10 [5]   0
Hits@level+ = [0+]  71 [1+]  43 [2+]  27 [3+]  19 [4+]  10 [5+]   0
Hits/KSLOC@level+ = [0+] 76.5086 [1+] 46.3362 [2+] 29.0948 [3+] 20.4741 [4+] 10.7759 [5+]   0
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.