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/fstrcmp-0.7.D001/fstrcmp/main.c Examining data/fstrcmp-0.7.D001/lib/ac/assert.h Examining data/fstrcmp-0.7.D001/lib/ac/ctype.h Examining data/fstrcmp-0.7.D001/lib/ac/errno.h Examining data/fstrcmp-0.7.D001/lib/ac/fcntl.h Examining data/fstrcmp-0.7.D001/lib/ac/getopt.h Examining data/fstrcmp-0.7.D001/lib/ac/pthread.h Examining data/fstrcmp-0.7.D001/lib/ac/pwd.h Examining data/fstrcmp-0.7.D001/lib/ac/stdarg.h Examining data/fstrcmp-0.7.D001/lib/ac/stddef.h Examining data/fstrcmp-0.7.D001/lib/ac/stdio.h Examining data/fstrcmp-0.7.D001/lib/ac/stdlib.h Examining data/fstrcmp-0.7.D001/lib/ac/string.c Examining data/fstrcmp-0.7.D001/lib/ac/string.h Examining data/fstrcmp-0.7.D001/lib/ac/sys/stat.h Examining data/fstrcmp-0.7.D001/lib/ac/sys/time.h Examining data/fstrcmp-0.7.D001/lib/ac/sys/types.h Examining data/fstrcmp-0.7.D001/lib/ac/unistd.h Examining data/fstrcmp-0.7.D001/lib/ac/wchar.h Examining data/fstrcmp-0.7.D001/lib/config.messy.h Examining data/fstrcmp-0.7.D001/lib/diffseq.h Examining data/fstrcmp-0.7.D001/lib/downcase.c Examining data/fstrcmp-0.7.D001/lib/downcase.h Examining data/fstrcmp-0.7.D001/lib/fmemcmp.c Examining data/fstrcmp-0.7.D001/lib/fmemcmpi.c Examining data/fstrcmp-0.7.D001/lib/fstrcasecmp.c Examining data/fstrcmp-0.7.D001/lib/fstrcasecmpi.c Examining data/fstrcmp-0.7.D001/lib/fstrcmp.c Examining data/fstrcmp-0.7.D001/lib/fstrcmp.h Examining data/fstrcmp-0.7.D001/lib/fstrcmpi.c Examining data/fstrcmp-0.7.D001/lib/fstrcoll.c Examining data/fstrcmp-0.7.D001/lib/fstrcolli.c Examining data/fstrcmp-0.7.D001/lib/fwcscmp.c Examining data/fstrcmp-0.7.D001/lib/fwcscmpi.c Examining data/fstrcmp-0.7.D001/lib/gcc_attributes.h Examining data/fstrcmp-0.7.D001/lib/mbs_to_wcs.c Examining data/fstrcmp-0.7.D001/lib/mbs_to_wcs.h Examining data/fstrcmp-0.7.D001/lib/minmax.h Examining data/fstrcmp-0.7.D001/lib/nmalloc.c Examining data/fstrcmp-0.7.D001/lib/nmalloc.h Examining data/fstrcmp-0.7.D001/lib/patchlevel.h Examining data/fstrcmp-0.7.D001/lib/program_name.c Examining data/fstrcmp-0.7.D001/lib/program_name.h Examining data/fstrcmp-0.7.D001/lib/version.c Examining data/fstrcmp-0.7.D001/lib/version.h Examining data/fstrcmp-0.7.D001/lib/version_print.c Examining data/fstrcmp-0.7.D001/lib/version_print.h Examining data/fstrcmp-0.7.D001/lib/warn_unused_result.h Examining data/fstrcmp-0.7.D001/test_user/main.c FINAL RESULTS: data/fstrcmp-0.7.D001/lib/program_name.c:93:13: [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. n = readlink("/proc/self/exe", buf, sizeof(buf) - 1); data/fstrcmp-0.7.D001/lib/ac/stdio.h:38:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. #define sprintf sprintf_is_dangerous__use_snprintf_instead@ data/fstrcmp-0.7.D001/lib/ac/stdio.h:39:9: [4] (buffer) vsprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. #define vsprintf sprintf_is_dangerous__use_vsnprintf_instead@ data/fstrcmp-0.7.D001/lib/gcc_attributes.h:24:55: [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. #define LIB_FORMAT_PRINTF(x, y) __attribute__((format(printf, x, y))) data/fstrcmp-0.7.D001/fstrcmp/main.c:412:13: [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, "AaCcPpSsVWw", options, 0); data/fstrcmp-0.7.D001/lib/program_name.c:107:35: [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. fstrcmp_program_name_set_real(getenv("_")); data/fstrcmp-0.7.D001/fstrcmp/main.c:161: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). fd = open(filename, O_RDONLY); data/fstrcmp-0.7.D001/lib/ac/string.c:58: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 buffer[16]; data/fstrcmp-0.7.D001/lib/ac/string.c:62:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buffer, "Error %d", n); data/fstrcmp-0.7.D001/lib/program_name.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 progname[256]; data/fstrcmp-0.7.D001/lib/program_name.c:91: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[2000]; data/fstrcmp-0.7.D001/fstrcmp/main.c:206:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nbytes = read(fd, *data, st.st_size); data/fstrcmp-0.7.D001/lib/downcase.c:34: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(in) + 1; data/fstrcmp-0.7.D001/lib/fstrcmp.c:27:29: [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 fmemcmp(string1, strlen(string1), string2, strlen(string2)); data/fstrcmp-0.7.D001/lib/fstrcmp.c:27:55: [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 fmemcmp(string1, strlen(string1), string2, strlen(string2)); data/fstrcmp-0.7.D001/lib/fstrcmpi.c:27: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). return fmemcmpi(string1, strlen(string1), string2, strlen(string2)); data/fstrcmp-0.7.D001/lib/fstrcmpi.c:27:56: [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 fmemcmpi(string1, strlen(string1), string2, strlen(string2)); data/fstrcmp-0.7.D001/lib/fwcscmp.c:111:13: [1] (buffer) wcslen: 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). size1 = wcslen(wcs1); data/fstrcmp-0.7.D001/lib/fwcscmp.c:112:13: [1] (buffer) wcslen: 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). size2 = wcslen(wcs2); data/fstrcmp-0.7.D001/lib/fwcscmpi.c:113:13: [1] (buffer) wcslen: 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). size1 = wcslen(wcs1); data/fstrcmp-0.7.D001/lib/fwcscmpi.c:114:13: [1] (buffer) wcslen: 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). size2 = wcslen(wcs2); data/fstrcmp-0.7.D001/lib/mbs_to_wcs.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). mbs_len = strlen(mbs) + 1; ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 3552 in approximately 0.15 seconds (23601 lines/second) Physical Source Lines of Code (SLOC) = 1505 Hits@level = [0] 20 [1] 11 [2] 5 [3] 2 [4] 3 [5] 1 Hits@level+ = [0+] 42 [1+] 22 [2+] 11 [3+] 6 [4+] 4 [5+] 1 Hits/KSLOC@level+ = [0+] 27.907 [1+] 14.6179 [2+] 7.30897 [3+] 3.98671 [4+] 2.65781 [5+] 0.664452 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.