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/catdvi-0.14/adobe2h.c Examining data/catdvi-0.14/adobetbl.h Examining data/catdvi-0.14/bytesex.c Examining data/catdvi-0.14/bytesex.h Examining data/catdvi-0.14/canvas.c Examining data/catdvi-0.14/canvas.h Examining data/catdvi-0.14/catdvi.c Examining data/catdvi-0.14/density.c Examining data/catdvi-0.14/density.h Examining data/catdvi-0.14/findtfm.h Examining data/catdvi-0.14/fixword.c Examining data/catdvi-0.14/fixword.h Examining data/catdvi-0.14/fntenc.c Examining data/catdvi-0.14/fntenc.h Examining data/catdvi-0.14/getopt1.c Examining data/catdvi-0.14/getopt.c Examining data/catdvi-0.14/getopt.h Examining data/catdvi-0.14/glyphops.c Examining data/catdvi-0.14/glyphops.h Examining data/catdvi-0.14/kpathsea.c Examining data/catdvi-0.14/layout.h Examining data/catdvi-0.14/linebuf.c Examining data/catdvi-0.14/linebuf.h Examining data/catdvi-0.14/outenc.c Examining data/catdvi-0.14/outenc.h Examining data/catdvi-0.14/page2.h Examining data/catdvi-0.14/page.h Examining data/catdvi-0.14/pageref.c Examining data/catdvi-0.14/pageref.h Examining data/catdvi-0.14/pse2unic.c Examining data/catdvi-0.14/readdvi.c Examining data/catdvi-0.14/readdvi.h Examining data/catdvi-0.14/regsta.c Examining data/catdvi-0.14/regsta.h Examining data/catdvi-0.14/sparse.c Examining data/catdvi-0.14/sparse.h Examining data/catdvi-0.14/tfminfo.c Examining data/catdvi-0.14/util.c Examining data/catdvi-0.14/util.h Examining data/catdvi-0.14/version.h Examining data/catdvi-0.14/vlist.c Examining data/catdvi-0.14/vlist.h Examining data/catdvi-0.14/fontinfo.h Examining data/catdvi-0.14/page.c Examining data/catdvi-0.14/fontinfo.c Examining data/catdvi-0.14/layout.c FINAL RESULTS: data/catdvi-0.14/adobe2h.c:148:6: [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( data/catdvi-0.14/adobe2h.c:165:7: [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( data/catdvi-0.14/adobe2h.c:181:6: [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( data/catdvi-0.14/pse2unic.c:358: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(enc_name, (char const *) (tok+1)); data/catdvi-0.14/util.c:39:33: [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. if (!suppress_warnings) vfprintf(stderr, format, args); data/catdvi-0.14/util.c:48:9: [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, args); data/catdvi-0.14/util.c:64: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, args); data/catdvi-0.14/util.c:87:9: [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, args); data/catdvi-0.14/util.c:179: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(su, s); data/catdvi-0.14/util.h:47:48: [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. void warning(const char * format, ...) FORMAT((printf, 1, 2)); data/catdvi-0.14/util.h:50:46: [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. void panic(const char * format, ...) FORMAT((printf, 1, 2)); data/catdvi-0.14/util.h:59:58: [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. void eassert(int expr, const char * format, ...) FORMAT((printf, 2, 3)); data/catdvi-0.14/util.h:69:57: [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. void pmesg(int level, const char * format, ...) FORMAT((printf, 2, 3)); data/catdvi-0.14/catdvi.c:89:23: [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. opt = getopt_long(argc, argv, shopt, lopt, 0); data/catdvi-0.14/getopt.c:210: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/catdvi-0.14/getopt.c:211: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/catdvi-0.14/getopt.c:403: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/catdvi-0.14/getopt.c:968:1: [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. getopt (argc, argv, optstring) data/catdvi-0.14/getopt.c:998:11: [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, "abc:d:0123456789"); data/catdvi-0.14/getopt.h:134: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/catdvi-0.14/getopt.h:136: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/catdvi-0.14/getopt.h:140: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/catdvi-0.14/getopt.h:153: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/catdvi-0.14/getopt.h:155: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/catdvi-0.14/getopt1.c:67: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 (argc, argv, options, long_options, opt_index) data/catdvi-0.14/getopt1.c:123:11: [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, "abc:d:0123456789", data/catdvi-0.14/adobe2h.c:60:9: [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). f = fopen(OUTFILE, "w"); data/catdvi-0.14/adobe2h.c:95:6: [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 s[A_MAX_LEN]; data/catdvi-0.14/bytesex.c:57:15: [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/catdvi-0.14/catdvi.c:230:27: [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). dvifile = fopen(argv[optind], "rb"); data/catdvi-0.14/fontinfo.c:88: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 encoding[ENCODING_LEN]; data/catdvi-0.14/fontinfo.c:89: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 family[FAMILY_LEN]; data/catdvi-0.14/fontinfo.c:233: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(fname, "rb"); data/catdvi-0.14/linebuf.c:45: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(this->gstring, garray, sizeof(glyph_t) * this->size_alloc); data/catdvi-0.14/linebuf.c:129: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( data/catdvi-0.14/outenc.c:35: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 const * const outenc_name_tbl[OE_TOOBIG] = { data/catdvi-0.14/outenc.c:588: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 outv[UTFVEC_MAXLEN]; data/catdvi-0.14/pse2unic.c:131: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 enc_name[TOK_MAXLEN]; /* name of the current encoding */ data/catdvi-0.14/pse2unic.c:156: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. static unsigned char tok[TOK_MAXLEN]; data/catdvi-0.14/pse2unic.c:347: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(fname, "r"); data/catdvi-0.14/pse2unic.c:349: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). rp = fopen(rname, "w"); data/catdvi-0.14/pse2unic.c:410: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(argv[2], "w"); data/catdvi-0.14/readdvi.c:162: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 comment[COMMENT_MAXLEN+1]; data/catdvi-0.14/regsta.c:30: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 const * regnames[NUM_REGS] = { "H", "V", "W", "X", "Y", "Z" }; data/catdvi-0.14/tfminfo.c:60: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(to + base, from, sizeof(char *) * count); data/catdvi-0.14/adobe2h.c:146:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, a, A_MAX_LEN); data/catdvi-0.14/getopt.c:233: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/catdvi-0.14/getopt.c:236: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/catdvi-0.14/getopt.c:434: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/catdvi-0.14/getopt.c:655: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/catdvi-0.14/getopt.c:679: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/catdvi-0.14/getopt.c:711: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/catdvi-0.14/getopt.c:727: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/catdvi-0.14/getopt.c:732: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/catdvi-0.14/getopt.c:843: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/catdvi-0.14/getopt.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/catdvi-0.14/getopt.c:886: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/catdvi-0.14/getopt.c:900: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/catdvi-0.14/getopt.c:904: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/catdvi-0.14/pse2unic.c:137:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(fp); data/catdvi-0.14/tfminfo.c:83: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(argv[1]), /* length of the fontnames non-directory part */ data/catdvi-0.14/util.c:177: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). su = malloc(strlen(s) + 1); ANALYSIS SUMMARY: Hits = 62 Lines analyzed = 12693 in approximately 0.41 seconds (31024 lines/second) Physical Source Lines of Code (SLOC) = 8696 Hits@level = [0] 63 [1] 17 [2] 19 [3] 13 [4] 13 [5] 0 Hits@level+ = [0+] 125 [1+] 62 [2+] 45 [3+] 26 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 14.3744 [1+] 7.12971 [2+] 5.17479 [3+] 2.98988 [4+] 1.49494 [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.