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/unifdef-2.10/version.h Examining data/unifdef-2.10/FreeBSD/err.c Examining data/unifdef-2.10/FreeBSD/getopt.c Examining data/unifdef-2.10/tests/NetBSD-42628.c Examining data/unifdef-2.10/tests/args1.c Examining data/unifdef-2.10/tests/args2.c Examining data/unifdef-2.10/tests/blank0d.c Examining data/unifdef-2.10/tests/blank0u.c Examining data/unifdef-2.10/tests/crlf.c Examining data/unifdef-2.10/tests/blank1d.c Examining data/unifdef-2.10/tests/blank1u.c Examining data/unifdef-2.10/tests/blank2d.c Examining data/unifdef-2.10/tests/blank2u.c Examining data/unifdef-2.10/tests/empty.c Examining data/unifdef-2.10/tests/blank3d.c Examining data/unifdef-2.10/tests/blank3u.c Examining data/unifdef-2.10/tests/blank4d.c Examining data/unifdef-2.10/tests/blank4u.c Examining data/unifdef-2.10/tests/broken2.h Examining data/unifdef-2.10/tests/broken3.h Examining data/unifdef-2.10/tests/broken4.h Examining data/unifdef-2.10/tests/debian-603860.c Examining data/unifdef-2.10/tests/if1-k.c Examining data/unifdef-2.10/tests/funlike.h Examining data/unifdef-2.10/tests/if1-kDU.c Examining data/unifdef-2.10/tests/if1.c Examining data/unifdef-2.10/tests/if1.h Examining data/unifdef-2.10/tests/if2-k.c Examining data/unifdef-2.10/tests/if2-kDU.c Examining data/unifdef-2.10/tests/if2.c Examining data/unifdef-2.10/tests/if3-k.c Examining data/unifdef-2.10/tests/if3-kDU.c Examining data/unifdef-2.10/tests/if3.c Examining data/unifdef-2.10/tests/if4-k.c Examining data/unifdef-2.10/tests/if4-kDU.c Examining data/unifdef-2.10/tests/if4.c Examining data/unifdef-2.10/tests/if5-k.c Examining data/unifdef-2.10/tests/if5-kDU.c Examining data/unifdef-2.10/tests/if5.c Examining data/unifdef-2.10/tests/if6.c Examining data/unifdef-2.10/tests/if6.h Examining data/unifdef-2.10/tests/none.c Examining data/unifdef-2.10/tests/small1.c Examining data/unifdef-2.10/tests/small2.c Examining data/unifdef-2.10/tests/spaces1.c Examining data/unifdef-2.10/tests/spaces2.c Examining data/unifdef-2.10/tests/spaces3.c Examining data/unifdef-2.10/tests/spaces4.c Examining data/unifdef-2.10/tests/whitespace.c Examining data/unifdef-2.10/unifdef.c Examining data/unifdef-2.10/unifdef.h Examining data/unifdef-2.10/win32/unifdef.h Examining data/unifdef-2.10/win32/win32.c FINAL RESULTS: data/unifdef-2.10/FreeBSD/err.c:61: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, ap); data/unifdef-2.10/FreeBSD/err.c:82: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, ap); data/unifdef-2.10/FreeBSD/err.c:116: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, ap); data/unifdef-2.10/FreeBSD/err.c:136: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, ap); data/unifdef-2.10/unifdef.c:841:4: [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(tline + len, newline); data/unifdef-2.10/win32/win32.c:58:5: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int snprintf(char *buf, size_t size, const char *format, ...) data/unifdef-2.10/FreeBSD/getopt.c:48: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(int nargc, char *nargv[], const char *ostr) data/unifdef-2.10/unifdef.c:257:16: [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. while ((opt = getopt(argc, argv, "i:D:U:f:I:M:o:x:bBcdehKklmnsStV")) != -1) data/unifdef-2.10/win32/unifdef.h:69:5: [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. int getopt(int nargc, char *nargv[], const char *ostr); data/unifdef-2.10/unifdef.c:165: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. static const char *symname[MAXSYMS]; /* symbol name */ data/unifdef-2.10/unifdef.c:166: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. static const char *value[MAXSYMS]; /* -Dsym=value */ data/unifdef-2.10/unifdef.c:179: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 tline[MAXLINE+EDITSLOP];/* input buffer plus space */ data/unifdef-2.10/unifdef.c:335:15: [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). exitmode = atoi(optarg); data/unifdef-2.10/unifdef.c:388:11: [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). input = fopen(ifn, "rb"); data/unifdef-2.10/unifdef.c:398: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). output = fopen(ofn, "wb"); data/unifdef-2.10/unifdef.c:569:28: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); } data/unifdef-2.10/unifdef.c:1441:10: [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). input = fopen(fn, "rb"); data/unifdef-2.10/unifdef.h:46:11: [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). int fd = mkstemp(tmp); data/unifdef-2.10/win32/win32.c:45:10: [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). return (fopen(_mktemp(tmp), "wb")); data/unifdef-2.10/unifdef.c:842: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). cp += strlen(newline); data/unifdef-2.10/unifdef.c:1053: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). if (strncmp(cp, op->str, strlen(op->str)) == 0) data/unifdef-2.10/unifdef.c:1057: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). cp += strlen(op->str); data/unifdef-2.10/unifdef.c:1470:13: [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). end = cp + strlen(cp); ANALYSIS SUMMARY: Hits = 23 Lines analyzed = 3037 in approximately 0.16 seconds (19022 lines/second) Physical Source Lines of Code (SLOC) = 2155 Hits@level = [0] 23 [1] 4 [2] 10 [3] 3 [4] 6 [5] 0 Hits@level+ = [0+] 46 [1+] 23 [2+] 19 [3+] 9 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 21.3457 [1+] 10.6729 [2+] 8.81671 [3+] 4.17633 [4+] 2.78422 [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.