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/proftpd-mod-vroot-0.9.8/fsio.c
Examining data/proftpd-mod-vroot-0.9.8/path.h
Examining data/proftpd-mod-vroot-0.9.8/path.c
Examining data/proftpd-mod-vroot-0.9.8/alias.c
Examining data/proftpd-mod-vroot-0.9.8/fsio.h
Examining data/proftpd-mod-vroot-0.9.8/mod_vroot.c
Examining data/proftpd-mod-vroot-0.9.8/t/api/fsio.c
Examining data/proftpd-mod-vroot-0.9.8/t/api/path.c
Examining data/proftpd-mod-vroot-0.9.8/t/api/alias.c
Examining data/proftpd-mod-vroot-0.9.8/t/api/tests.h
Examining data/proftpd-mod-vroot-0.9.8/t/api/tests.c
Examining data/proftpd-mod-vroot-0.9.8/t/api/stubs.c
Examining data/proftpd-mod-vroot-0.9.8/alias.h
Examining data/proftpd-mod-vroot-0.9.8/debian/proftp_code/buildstamp.h
Examining data/proftpd-mod-vroot-0.9.8/debian/proftp_code/config.h

FINAL RESULTS:

data/proftpd-mod-vroot-0.9.8/fsio.c:301:12:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    return readlink(readlink_path, buf, bufsz);
data/proftpd-mod-vroot-0.9.8/fsio.c:334:9:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
  res = readlink(vpath, buf, bufsz);
data/proftpd-mod-vroot-0.9.8/fsio.c:372:12:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    return chmod(path, mode);
data/proftpd-mod-vroot-0.9.8/fsio.c:379:10:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
  return chmod(vpath, mode);
data/proftpd-mod-vroot-0.9.8/fsio.c:392:12:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
    return chown(path, uid, gid);
data/proftpd-mod-vroot-0.9.8/fsio.c:399:10:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
  return chown(vpath, uid, gid);
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:85:5:  [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, fmt, msg);
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:99:5:  [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, fmt, msg);
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:128:5:  [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, fmt, msg);
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:145:5:  [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, fmt, msg);
data/proftpd-mod-vroot-0.9.8/fsio.c:481:11:  [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.
      if (chroot(server_root) < 0) {
data/proftpd-mod-vroot-0.9.8/t/api/alias.c:39:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/alias.c:45:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/fsio.c:37:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/fsio.c:43:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/path.c:37:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/path.c:43:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:79:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:93:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:122:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/stubs.c:139:7:  [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 (getenv("TEST_VERBOSE") != NULL) {
data/proftpd-mod-vroot-0.9.8/t/api/tests.c:66:15:  [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.
  requested = getenv("VROOT_TEST_SUITE");
data/proftpd-mod-vroot-0.9.8/t/api/tests.c:97:15:  [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.
  requested = getenv("VROOT_TEST_NOFORK");
data/proftpd-mod-vroot-0.9.8/t/api/tests.c:101: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.
    requested = getenv("CK_DEFAULT_TIMEOUT");
data/proftpd-mod-vroot-0.9.8/fsio.c:36: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 vpath[PR_TUNABLE_PATH_MAX + 1], *path = NULL;
data/proftpd-mod-vroot-0.9.8/fsio.c:71: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 vpath[PR_TUNABLE_PATH_MAX + 1], *path = NULL;
data/proftpd-mod-vroot-0.9.8/fsio.c:137: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 vpath1[PR_TUNABLE_PATH_MAX + 1], vpath2[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:161: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:193: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:202: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).
    return open(path, flags, PR_OPEN_MODE);
data/proftpd-mod-vroot-0.9.8/fsio.c:209: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).
  return open(vpath, flags, PR_OPEN_MODE);
data/proftpd-mod-vroot-0.9.8/fsio.c:215: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:241: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 vpath1[PR_TUNABLE_PATH_MAX + 1], vpath2[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:265: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 vpath1[PR_TUNABLE_PATH_MAX + 1], vpath2[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:291: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 vpath[PR_TUNABLE_PATH_MAX + 1], *path = NULL, *alias_path = NULL;
data/proftpd-mod-vroot-0.9.8/fsio.c:343: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:363: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:383: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:405: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:431: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 base[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:548: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 vpath[PR_TUNABLE_PATH_MAX + 1], *vpathp = NULL, *alias_path = NULL;
data/proftpd-mod-vroot-0.9.8/fsio.c:612: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 vpath[PR_TUNABLE_PATH_MAX + 1], *path = NULL;
data/proftpd-mod-vroot-0.9.8/fsio.c:720: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 vpath[PR_TUNABLE_PATH_MAX + 1], *path = NULL;
data/proftpd-mod-vroot-0.9.8/fsio.c:772: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 data[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:947: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/fsio.c:967: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 vpath[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/mod_vroot.c:60: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 src_path[PR_TUNABLE_PATH_MAX+1], dst_path[PR_TUNABLE_PATH_MAX+1];
data/proftpd-mod-vroot-0.9.8/path.c:28: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 vroot_base[PR_TUNABLE_PATH_MAX + 1];
data/proftpd-mod-vroot-0.9.8/path.c:230: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 buf[PR_TUNABLE_PATH_MAX + 1], *bufp = NULL;
data/proftpd-mod-vroot-0.9.8/path.c:330: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(path + tmplen + 1, bufp, buflen);
data/proftpd-mod-vroot-0.9.8/fsio.c:94: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).
  pathlen = strlen(path);
data/proftpd-mod-vroot-0.9.8/fsio.c:460: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).
    if (server_root[strlen(server_root)-1] == '/') {
data/proftpd-mod-vroot-0.9.8/fsio.c:461: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).
      ptr = &(server_root[strlen(server_root)-1]);
data/proftpd-mod-vroot-0.9.8/fsio.c:470:38:  [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).
    res = strncmp(path, server_root, strlen(server_root));
data/proftpd-mod-vroot-0.9.8/fsio.c:492: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).
      pr_fs_clean_path(path + strlen(server_root), base, sizeof(base));
data/proftpd-mod-vroot-0.9.8/fsio.c:526: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).
  baselen = strlen(base);
data/proftpd-mod-vroot-0.9.8/fsio.c:688: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).
  dir_pathlen = strlen(dir_path);
data/proftpd-mod-vroot-0.9.8/fsio.c:749: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).
  pathlen = strlen(path);
data/proftpd-mod-vroot-0.9.8/fsio.c:825:41:  [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).
        pstrdup(vroot_dir_pool, vpath), strlen(vpath) + 1) < 0) {
data/proftpd-mod-vroot-0.9.8/mod_vroot.c:231: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).
  pathlen = strlen(path);
data/proftpd-mod-vroot-0.9.8/path.c:162:16:  [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).
  ptr = path + strlen(path) - 1;
data/proftpd-mod-vroot-0.9.8/path.c:218: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).
  real_pathlen = strlen(real_path);
data/proftpd-mod-vroot-0.9.8/path.c:296:16:  [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).
      ptrlen = strlen(ptr);
data/proftpd-mod-vroot-0.9.8/path.c:321:14:  [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).
    buflen = strlen(bufp) + 1;
data/proftpd-mod-vroot-0.9.8/path.c:322:14:  [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).
    tmplen = strlen(path);

ANALYSIS SUMMARY:

Hits = 65
Lines analyzed = 4135 in approximately 0.13 seconds (31296 lines/second)
Physical Source Lines of Code (SLOC) = 2101
Hits@level = [0]  18 [1]  15 [2]  26 [3]  14 [4]   4 [5]   6
Hits@level+ = [0+]  83 [1+]  65 [2+]  50 [3+]  24 [4+]  10 [5+]   6
Hits/KSLOC@level+ = [0+] 39.505 [1+] 30.9376 [2+] 23.7982 [3+] 11.4231 [4+] 4.75964 [5+] 2.85578
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.