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/tnef-1.4.18/src/alloc.c
Examining data/tnef-1.4.18/src/alloc.h
Examining data/tnef-1.4.18/src/attr.c
Examining data/tnef-1.4.18/src/attr.h
Examining data/tnef-1.4.18/src/common.h
Examining data/tnef-1.4.18/src/date.c
Examining data/tnef-1.4.18/src/date.h
Examining data/tnef-1.4.18/src/debug.c
Examining data/tnef-1.4.18/src/debug.h
Examining data/tnef-1.4.18/src/file.c
Examining data/tnef-1.4.18/src/file.h
Examining data/tnef-1.4.18/src/main.c
Examining data/tnef-1.4.18/src/mapi_attr.c
Examining data/tnef-1.4.18/src/mapi_attr.h
Examining data/tnef-1.4.18/src/options.c
Examining data/tnef-1.4.18/src/options.h
Examining data/tnef-1.4.18/src/path.c
Examining data/tnef-1.4.18/src/path.h
Examining data/tnef-1.4.18/src/replace/basename.c
Examining data/tnef-1.4.18/src/replace/dummy.c
Examining data/tnef-1.4.18/src/replace/getopt_long.c
Examining data/tnef-1.4.18/src/replace/getopt_long.h
Examining data/tnef-1.4.18/src/replace/malloc.c
Examining data/tnef-1.4.18/src/replace/strdup.c
Examining data/tnef-1.4.18/src/rtf.c
Examining data/tnef-1.4.18/src/rtf.h
Examining data/tnef-1.4.18/src/tnef.c
Examining data/tnef-1.4.18/src/tnef.h
Examining data/tnef-1.4.18/src/util.c
Examining data/tnef-1.4.18/src/util.h
Examining data/tnef-1.4.18/src/write.c
Examining data/tnef-1.4.18/src/write.h
Examining data/tnef-1.4.18/src/xstrdup.c

FINAL RESULTS:

data/tnef-1.4.18/src/common.h:44:14:  [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).
extern char *strcpy (char *, const char *);
data/tnef-1.4.18/src/common.h:45:14:  [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).
extern char *strcat (char *, const char *);
data/tnef-1.4.18/src/common.h:100:26:  [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.
#  define VPRINTF(s,f,a) vfprintf((s),(f),(a))
data/tnef-1.4.18/src/main.c:93:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (stdout, USAGE, PACKAGE_BUGREPORT);
data/tnef-1.4.18/src/main.c:257:13:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            fprintf (stderr, NO_WARRANTY, PACKAGE_NAME, PACKAGE_NAME);
data/tnef-1.4.18/src/path.c:59: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 (filename, fname1);
data/tnef-1.4.18/src/path.c:68:13:  [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, fname2);
data/tnef-1.4.18/src/path.c:111:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf (tmp, "%s.%d", fname, counter++);
data/tnef-1.4.18/src/tnef.c:126: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 (tmp, filename);
data/tnef-1.4.18/src/tnef.c:127:9:  [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 (tmp, ext);
data/tnef-1.4.18/src/tnef.c:130: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 (mime, type);
data/tnef-1.4.18/src/write.c:25:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (fp, UINT8_FMT, b);
data/tnef-1.4.18/src/write.c:31:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (fp, UINT16_FMT, s);
data/tnef-1.4.18/src/write.c:37:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (fp, UINT32_FMT, l);
data/tnef-1.4.18/src/write.c:43:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (fp, INT8_FMT, b);
data/tnef-1.4.18/src/write.c:49:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (fp, INT16_FMT, s);
data/tnef-1.4.18/src/write.c:55:5:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    fprintf (fp, INT32_FMT, l);
data/tnef-1.4.18/src/main.c:182:17:  [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 ((i = getopt_long (argc, argv, "f:C:x:vVwhtK",
data/tnef-1.4.18/src/replace/getopt_long.c:185:9:  [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.
#ifndef getenv
data/tnef-1.4.18/src/replace/getopt_long.c:186:14:  [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.
extern char *getenv ();
data/tnef-1.4.18/src/replace/getopt_long.c:369:21:  [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.
  posixly_correct = getenv ("POSIXLY_CORRECT");
data/tnef-1.4.18/src/replace/getopt_long.c:930:1:  [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.
getopt_long (int argc, char* const *argv, 
data/tnef-1.4.18/src/replace/getopt_long.h:112:12:  [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.
extern int getopt (int argc, char *const *argv, const char *shortopts);
data/tnef-1.4.18/src/replace/getopt_long.h:114:12:  [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.
extern int getopt ();
data/tnef-1.4.18/src/replace/getopt_long.h:116:12:  [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.
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
data/tnef-1.4.18/src/replace/getopt_long.h:128:12:  [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.
extern int getopt ();
data/tnef-1.4.18/src/replace/getopt_long.h:129:12:  [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.
extern int getopt_long ();
data/tnef-1.4.18/src/common.h:51:29:  [2] (buffer) bcopy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
#    define memmove (d,s,n) bcopy((s),(d),(n))
data/tnef-1.4.18/src/date.c:45: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.
    static char buf[32];
data/tnef-1.4.18/src/file.c:45: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[BUFSIZ + 1];
data/tnef-1.4.18/src/file.c:122:14:  [2] (misc) fopen:
  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).
        fp = fopen (path, "wb");
data/tnef-1.4.18/src/main.c:361:14:  [2] (misc) fopen:
  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).
        fp = fopen (in_file, "rb");
data/tnef-1.4.18/src/path.c:182: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 hex_digits[16] = {
data/tnef-1.4.18/src/replace/strdup.c:36:28:  [2] (buffer) bcopy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
#    define memmove(d,s,n) bcopy((s),(d),(n));
data/tnef-1.4.18/src/rtf.c:178:14:  [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  dict[4096];
data/tnef-1.4.18/src/util.c:62:14:  [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[4];
data/tnef-1.4.18/src/util.c:68:14:  [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[2];
data/tnef-1.4.18/src/util.c:75:14:  [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[1];
data/tnef-1.4.18/src/attr.c:171:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy (buf, (char*)attr->buf, attr->len);
data/tnef-1.4.18/src/main.c:109: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).
    if (strlen(optarg) == 0 || strlen(optarg) > 3)
data/tnef-1.4.18/src/main.c:109:32:  [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 (strlen(optarg) == 0 || strlen(optarg) > 3)
data/tnef-1.4.18/src/path.c:55: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 (fname1);
data/tnef-1.4.18/src/path.c:56:28:  [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 (fname2) len += strlen (fname2);
data/tnef-1.4.18/src/path.c:63: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).
            if ((filename[strlen(filename)-1] != '/')
data/tnef-1.4.18/src/path.c:66:17:  [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/tnef-1.4.18/src/path.c:74: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).
    while ((len=strlen(filename)) > 0)
data/tnef-1.4.18/src/path.c:103:19:  [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_t len = (strlen(fname)
data/tnef-1.4.18/src/path.c:209:36:  [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).
    buf = CHECKED_XCALLOC( char, 3*strlen(fname)+SLOP );
data/tnef-1.4.18/src/replace/getopt_long.c:206:51:  [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 (!defined __STDC__ || !__STDC__) && !defined strlen
data/tnef-1.4.18/src/replace/getopt_long.c:209: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).
extern int strlen (const char *);
data/tnef-1.4.18/src/replace/getopt_long.c:400: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).
	      int len = nonoption_flags_max_len = strlen (orig_str);
data/tnef-1.4.18/src/replace/getopt_long.c:617: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).
		== (unsigned int) strlen (p->name))
data/tnef-1.4.18/src/replace/getopt_long.c:641: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).
	  nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:673: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).
		  nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:689: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).
		  nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:694: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).
	  nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:805:51:  [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 ((unsigned int) (nameend - nextchar) == strlen (p->name))
data/tnef-1.4.18/src/replace/getopt_long.c:828: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).
	    nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:848:19:  [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).
		    nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:862:19:  [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).
		    nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/getopt_long.c:866: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).
	    nextchar += strlen (nextchar);
data/tnef-1.4.18/src/replace/strdup.c:33: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).
extern size_t strlen (const char *);
data/tnef-1.4.18/src/replace/strdup.c:45: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).
    size_t len = strlen(str);
data/tnef-1.4.18/src/rtf.c:173: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).
    const size_t rtf_prebuf_len = strlen( rtf_prebuf );
data/tnef-1.4.18/src/tnef.c:66:20:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int tmp_char = fgetc(in);
data/tnef-1.4.18/src/tnef.c:125: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).
                              strlen(filename) + strlen(ext) + 1);
data/tnef-1.4.18/src/tnef.c:125:50:  [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(filename) + strlen(ext) + 1);
data/tnef-1.4.18/src/tnef.c:129: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).
        char *mime = CHECKED_XCALLOC(char, strlen(type) + 1);
data/tnef-1.4.18/src/tnef.c:203:29:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    int c = fgetc( input_file );
data/tnef-1.4.18/src/xstrdup.c:36:40:  [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).
        alloc_limit_assert ("xstrdup", strlen(str));

ANALYSIS SUMMARY:

Hits = 70
Lines analyzed = 4961 in approximately 0.16 seconds (30843 lines/second)
Physical Source Lines of Code (SLOC) = 3223
Hits@level = [0]  80 [1]  32 [2]  11 [3]  10 [4]  17 [5]   0
Hits@level+ = [0+] 150 [1+]  70 [2+]  38 [3+]  27 [4+]  17 [5+]   0
Hits/KSLOC@level+ = [0+] 46.5405 [1+] 21.7189 [2+] 11.7903 [3+] 8.37729 [4+] 5.27459 [5+]   0
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.