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/wipe-0.24/arcfour.c
Examining data/wipe-0.24/arcfour.h
Examining data/wipe-0.24/md5.c
Examining data/wipe-0.24/md5.h
Examining data/wipe-0.24/misc.c
Examining data/wipe-0.24/misc.h
Examining data/wipe-0.24/random.c
Examining data/wipe-0.24/random.h
Examining data/wipe-0.24/wipe.c

FINAL RESULTS:

data/wipe-0.24/wipe.c:943:25:  [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 (fn, 0700)) {
data/wipe-0.24/wipe.c:1234:17:  [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.
            m = readlink (fn, buf, NAME_MAX);
data/wipe-0.24/wipe.c:1306:21:  [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 (fn, st.st_mode | 0700)) {
data/wipe-0.24/wipe.c:1319:21:  [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 (fn, st.st_mode | 0700)) {
data/wipe-0.24/misc.c:39: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, fmt, arg);
data/wipe-0.24/misc.c:54: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, fmt, arg);
data/wipe-0.24/misc.c:66:3:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
  vsprintf (buf, fmt, arg);
data/wipe-0.24/misc.c:68: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 (s, buf);
data/wipe-0.24/misc.c:79: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, fmt, arg);
data/wipe-0.24/random.c:115:7:  [4] (shell) popen:
  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.
  f = popen (o_randomcmd, "r");
data/wipe-0.24/wipe.c:652:9:  [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 (oldname, fn);
data/wipe-0.24/wipe.c:653:9:  [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 (newname, fn);
data/wipe-0.24/wipe.c:1401: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, msg, va);
data/wipe-0.24/wipe.c:1681:18:  [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 (t || access (o_devrandom, R_OK)) {
data/wipe-0.24/wipe.c:1683: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.
            if (access (o_devrandom, X_OK))
data/wipe-0.24/wipe.c:1728:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf (b, "%d regular file%s", nreg, (nreg>1)?"s":"");
data/wipe-0.24/wipe.c:1733:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf (b, "%s%d director%s",
data/wipe-0.24/wipe.c:1740:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf (b, "%s%d symlink%s%s:",
data/wipe-0.24/wipe.c:1749:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf (b, "%s%d special file%s",
data/wipe-0.24/random.c:177:7:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
  r = random ();
data/wipe-0.24/random.c:183:18:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    rand_extra = random () << 1;
data/wipe-0.24/random.c:278:14:  [3] (random) srandom:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
      (void) srandom (key[0] | key[1]<<8 | key[2]<<16 | key[3]<<24);
data/wipe-0.24/random.c:280:7:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
      srand (key[0] | key[1]<<8 | key[2]<<16 | key[3]<<24);
data/wipe-0.24/wipe.c:1533:13:  [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.
        c = getopt (argc, argv, OPTSTR);
data/wipe-0.24/wipe.c:1679: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.
        t = getenv ("WIPE_SEEDPIPE");
data/wipe-0.24/md5.c:54:17:  [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 unsigned char PADDING[64] = {
data/wipe-0.24/md5.c:152:25:  [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.
void MD5Final (unsigned char digest[16], MD5_CTX *mdContext)
data/wipe-0.24/md5.h:59: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 in[64];                              /* input buffer */
data/wipe-0.24/md5.h:64:24:  [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.
void MD5Final(unsigned char digest[16], MD5_CTX *mdContext);
data/wipe-0.24/misc.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 buf[1024];
data/wipe-0.24/random.c:95:8:  [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 (o_devrandom, O_RDONLY);
data/wipe-0.24/wipe.c:510: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 (dn, fn, dl - 1);
data/wipe-0.24/wipe.c:527: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 valid_filename_chars[64] =
data/wipe-0.24/wipe.c:655:22:  [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 dir_fd = open (dir, O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
data/wipe-0.24/wipe.c:674:25:  [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 (oldname + (base - newname), base, len + 1);
data/wipe-0.24/wipe.c:935:14:  [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 (fn, O_WRONLY | O_SYNC | O_NONBLOCK);
data/wipe-0.24/wipe.c:937:14:  [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 (fn, O_WRONLY | O_NONBLOCK);
data/wipe-0.24/wipe.c:946:33:  [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).
                    } else fd = open (fn, O_WRONLY);
data/wipe-0.24/wipe.c:1105:25:  [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[30];
data/wipe-0.24/wipe.c:1106:25:  [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_bs[sizeof (buf1)];
data/wipe-0.24/wipe.c:1107:25:  [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 buf2[18];
data/wipe-0.24/wipe.c:1108:25:  [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 buf2_bs[sizeof(buf2)];
data/wipe-0.24/wipe.c:1231:13:  [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[NAME_MAX+1];
data/wipe-0.24/wipe.c:1538:39:  [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).
                      o_skip_passes = atoi(optarg);
data/wipe-0.24/wipe.c:1557:43:  [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).
                            current_int = atoi(pch);
data/wipe-0.24/wipe.c:1586:43:  [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).
            case 'P': o_name_max_passes = atoi (optarg); break;
data/wipe-0.24/wipe.c:1591:42:  [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).
            case 'T': o_name_max_tries = atoi (optarg); break;
data/wipe-0.24/wipe.c:1595:43:  [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).
                      o_lg2_buffer_size = atoi (optarg);
data/wipe-0.24/wipe.c:1622:42:  [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).
            case 'Q':   o_quick_passes = atoi (optarg);
data/wipe-0.24/wipe.c:1723: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.
        char buf2[80];
data/wipe-0.24/wipe.c:1724: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.
        char buf[80];
data/wipe-0.24/arcfour.c:63:30:  [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).
  arcfour_SetupKey (TESTKEY, strlen (TESTKEY), &ks);
data/wipe-0.24/misc.c:67: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).
  s = xmalloc (strlen (buf)+1);
data/wipe-0.24/random.c:83:62:  [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).
  for (pt = environ; *pt; pt++) MD5Update (&md5, (u8 *) *pt, strlen (*pt));
data/wipe-0.24/random.c:98:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if (16 != read (fd, buf, 16))
data/wipe-0.24/wipe.c:643:12:  [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).
    fn_l = strlen (fn);
data/wipe-0.24/wipe.c:659:15:  [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(base);
data/wipe-0.24/wipe.c:791:11:  [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(buf);
data/wipe-0.24/wipe.c:1729: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).
            b += strlen (b);
data/wipe-0.24/wipe.c:1736: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).
            b += strlen (b);
data/wipe-0.24/wipe.c:1746: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).
            b += strlen(b);
data/wipe-0.24/wipe.c:1766:35:  [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 (buf2[0]) buf2[strlen (buf2)-1] = 0;

ANALYSIS SUMMARY:

Hits = 62
Lines analyzed = 2804 in approximately 0.10 seconds (28611 lines/second)
Physical Source Lines of Code (SLOC) = 1925
Hits@level = [0]  59 [1]  11 [2]  26 [3]   6 [4]  15 [5]   4
Hits@level+ = [0+] 121 [1+]  62 [2+]  51 [3+]  25 [4+]  19 [5+]   4
Hits/KSLOC@level+ = [0+] 62.8571 [1+] 32.2078 [2+] 26.4935 [3+] 12.987 [4+] 9.87013 [5+] 2.07792
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.