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/enca-1.19/src/convert_iconv.c Examining data/enca-1.19/src/locale_detect.c Examining data/enca-1.19/src/getopt.h Examining data/enca-1.19/src/getopt_long.c Examining data/enca-1.19/src/convert.c Examining data/enca-1.19/src/convert_recode.c Examining data/enca-1.19/src/convert_extern.c Examining data/enca-1.19/src/filebuf.c Examining data/enca-1.19/src/enca.c Examining data/enca-1.19/src/common.h Examining data/enca-1.19/src/options.c Examining data/enca-1.19/tools/make_hash.c Examining data/enca-1.19/tools/encodings.h Examining data/enca-1.19/test/simtable.c Examining data/enca-1.19/data/slovak/slovak.h Examining data/enca-1.19/data/bulgarian/bulgarian.h Examining data/enca-1.19/data/czech/czech.h Examining data/enca-1.19/data/belarusian/belarusian.h Examining data/enca-1.19/data/findletters.c Examining data/enca-1.19/data/estonian/estonian.h Examining data/enca-1.19/data/basetoc.c Examining data/enca-1.19/data/mystrings.c Examining data/enca-1.19/data/russian/russian.h Examining data/enca-1.19/data/polish/polish.h Examining data/enca-1.19/data/hungarian/hungarian.h Examining data/enca-1.19/data/xlt.c Examining data/enca-1.19/data/lithuanian/lithuanian.h Examining data/enca-1.19/data/chinese/chinese.h Examining data/enca-1.19/data/chinese/zh_weight_big5.h Examining data/enca-1.19/data/chinese/zh_weight_gbk.h Examining data/enca-1.19/data/countpair.c Examining data/enca-1.19/data/ukrainian/ukrainian.h Examining data/enca-1.19/data/pairtoc.c Examining data/enca-1.19/data/countall.c Examining data/enca-1.19/data/latvian/latvian.h Examining data/enca-1.19/data/croatian/croatian.h Examining data/enca-1.19/data/slovene/slovene.h Examining data/enca-1.19/lib/lang_et.c Examining data/enca-1.19/lib/lang.c Examining data/enca-1.19/lib/encnames.c Examining data/enca-1.19/lib/common.c Examining data/enca-1.19/lib/lang_sk.c Examining data/enca-1.19/lib/unicodemap.c Examining data/enca-1.19/lib/lang_hu.c Examining data/enca-1.19/lib/lang_cs.c Examining data/enca-1.19/lib/filters.c Examining data/enca-1.19/lib/utf8_double.c Examining data/enca-1.19/lib/guess.c Examining data/enca-1.19/lib/lang_lt.c Examining data/enca-1.19/lib/internal.h Examining data/enca-1.19/lib/lang_be.c Examining data/enca-1.19/lib/lang_bg.c Examining data/enca-1.19/lib/lang_hr.c Examining data/enca-1.19/lib/lang_ru.c Examining data/enca-1.19/lib/ctype.c Examining data/enca-1.19/lib/lang_pl.c Examining data/enca-1.19/lib/enca.h Examining data/enca-1.19/lib/lang_uk.c Examining data/enca-1.19/lib/enca.c Examining data/enca-1.19/lib/lang_zh.c Examining data/enca-1.19/lib/multibyte.c Examining data/enca-1.19/lib/lang_lv.c Examining data/enca-1.19/lib/pair.c Examining data/enca-1.19/lib/lang_sl.c Examining data/enca-1.19/iconvcap.c Examining data/enca-1.19/iconvenc.h FINAL RESULTS: data/enca-1.19/lib/common.c:87:12: [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). return strcpy(enca_malloc(strlen(s) + 1), s); data/enca-1.19/src/convert_extern.c:116:7: [4] (shell) execlp: 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. execlp(extern_converter, extern_converter, data/enca-1.19/src/convert_extern.c:120:7: [4] (shell) execlp: 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. execlp(extern_converter, extern_converter, data/enca-1.19/src/convert_extern.c:201:10: [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. || access(extern_converter, X_OK) != 0) { data/enca-1.19/src/getopt.h:145: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/enca-1.19/src/getopt.h:147: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/enca-1.19/src/getopt.h:151: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/enca-1.19/src/getopt.h:164: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/enca-1.19/src/getopt.h:166: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/enca-1.19/src/getopt_long.c:201: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/enca-1.19/src/getopt_long.c:202: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/enca-1.19/src/getopt_long.c:334: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/enca-1.19/src/getopt_long.c:873: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/enca-1.19/src/getopt_long.c:885: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/enca-1.19/src/options.c:247:15: [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 ((c = getopt_long(argc, argv, short_options, data/enca-1.19/src/options.c:381: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. charset = getenv(RECODE_CHARSET_VAR); data/enca-1.19/src/options.c:451: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. encaenv = getenv(ENCA_ENV_VAR); data/enca-1.19/src/options.c:520: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. encaenv = getenv(ENCA_ENV_VAR); data/enca-1.19/data/chinese/chinese.h:8: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 name[2]; data/enca-1.19/data/countpair.c:22:7: [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(argv[1], "r"); data/enca-1.19/data/findletters.c:11:7: [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(argv[1], "r"); data/enca-1.19/data/mystrings.c:15: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 old[MINTEXT - 1]; data/enca-1.19/data/pairtoc.c:15: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 *pairs[0x100]; data/enca-1.19/data/pairtoc.c:26:7: [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(argv[2], "r"); data/enca-1.19/data/xlt.c:9: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 xlt[0x100]; data/enca-1.19/data/xlt.c:16:7: [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(argv[1], "r"); data/enca-1.19/data/xlt.c:21:7: [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(argv[2], "r"); data/enca-1.19/iconvcap.c:328:12: [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). if ((f = fopen(fname, "r")) == NULL) { data/enca-1.19/lib/guess.c:301:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. analyser->buffer = memcpy(enca_malloc(size), buffer, size); data/enca-1.19/lib/guess.c:431: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 old[BIN_TEXT_CHAR_MIN - 1]; /* saved maybe-text characters */ data/enca-1.19/lib/multibyte.c:560:14: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. buffer = memcpy(enca_malloc(size), buffer, size); data/enca-1.19/src/convert.c:490:7: [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(xdata.tables + 0x100*i, xdata.tables, 0x100); data/enca-1.19/src/convert_extern.c:44:11: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. # define vfork fork data/enca-1.19/src/convert_extern.c:112:9: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. pid = vfork(); data/enca-1.19/src/filebuf.c:29:5: [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 open(const char *pathname, int flags, mode_t mode); data/enca-1.19/src/filebuf.c:320:13: [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). if ((fd = mkstemp(temp_filename)) < 0) { data/enca-1.19/src/filebuf.c:453:18: [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). file->stream = fopen(file->name, mode); data/enca-1.19/data/countall.c:17:15: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getchar()) != EOF) data/enca-1.19/data/countpair.c:34:9: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getchar(); data/enca-1.19/data/mystrings.c:19:15: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getchar()) != EOF) { data/enca-1.19/data/pairtoc.c:33:19: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((first = getchar()) != EOF) { data/enca-1.19/data/pairtoc.c:37:5: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); /* : */ data/enca-1.19/data/pairtoc.c:39:22: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((second = getchar()) != '\n') data/enca-1.19/data/xlt.c:43:15: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getchar()) != EOF) data/enca-1.19/iconvcap.c:35:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). char* strncpy(char *dest, char *src, size_t n); data/enca-1.19/iconvcap.c:352:18: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). p_e->enc = strncpy((char*)malloc(se-sb), sb+1, se-sb-1); data/enca-1.19/lib/common.c:87: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). return strcpy(enca_malloc(strlen(s) + 1), s); data/enca-1.19/lib/common.c:113: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). if ((n = strlen(needle)) == 0) data/enca-1.19/lib/common.c:182:10: [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). n += strlen(s); data/enca-1.19/lib/common.c:216:8: [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). n1 = strlen(str); data/enca-1.19/lib/common.c:220:10: [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). n += strlen(s); data/enca-1.19/src/filebuf.c:115:7: [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). n = strlen(name); data/enca-1.19/src/getopt_long.c:224: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/enca-1.19/src/getopt_long.c:227: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/enca-1.19/src/getopt_long.c:557: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/enca-1.19/src/getopt_long.c:584: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/enca-1.19/src/getopt_long.c:616: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/enca-1.19/src/getopt_long.c:632: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/enca-1.19/src/getopt_long.c:637: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/enca-1.19/src/getopt_long.c:748: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/enca-1.19/src/getopt_long.c:771: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/enca-1.19/src/getopt_long.c:791: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/enca-1.19/src/getopt_long.c:805: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/enca-1.19/src/getopt_long.c:809: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/enca-1.19/src/locale_detect.c:220:7: [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). n = strlen(locname); data/enca-1.19/src/locale_detect.c:292:7: [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). n = strlen(s); data/enca-1.19/src/options.c:933: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). j = strlen(enca_language_english_name(l[i])); data/enca-1.19/tools/make_hash.c:115: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). const int len = strlen(name); ANALYSIS SUMMARY: Hits = 68 Lines analyzed = 22454 in approximately 0.87 seconds (25940 lines/second) Physical Source Lines of Code (SLOC) = 16014 Hits@level = [0] 179 [1] 31 [2] 19 [3] 14 [4] 4 [5] 0 Hits@level+ = [0+] 247 [1+] 68 [2+] 37 [3+] 18 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 15.424 [1+] 4.24628 [2+] 2.31048 [3+] 1.12402 [4+] 0.249781 [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.