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/fcrackzip-1.0/crackdef.c Examining data/fcrackzip-1.0/crc32.h Examining data/fcrackzip-1.0/crack.c Examining data/fcrackzip-1.0/crack.h Examining data/fcrackzip-1.0/getopt.c Examining data/fcrackzip-1.0/getopt.h Examining data/fcrackzip-1.0/getopt1.c Examining data/fcrackzip-1.0/cpmask.c Examining data/fcrackzip-1.0/zipcrack.c Examining data/fcrackzip-1.0/zipinfo.c Examining data/fcrackzip-1.0/main.c FINAL RESULTS: data/fcrackzip-1.0/main.c:151:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buff, "unzip -qqtP \"%s\" %s " DEVNULL, escpw, path); data/fcrackzip-1.0/main.c:153:12: [4] (shell) system: 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. status = system (buff); data/fcrackzip-1.0/main.c:258:3: [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 ((char *) files, (char *) header); /* yeah, dirty... */ data/fcrackzip-1.0/main.c:544:9: [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. printf (PACKAGE " version " VERSION "\n"); data/fcrackzip-1.0/getopt.c:191:7: [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. char *getenv (); data/fcrackzip-1.0/getopt.c:322: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/fcrackzip-1.0/getopt.c:349:25: [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. nonoption_flags = getenv (var); data/fcrackzip-1.0/getopt.c:863: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/fcrackzip-1.0/getopt.c:893: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/fcrackzip-1.0/getopt.h:106: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/fcrackzip-1.0/getopt.h:108: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/fcrackzip-1.0/getopt.h:110: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/fcrackzip-1.0/getopt.h:122: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/fcrackzip-1.0/getopt.h:123: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/fcrackzip-1.0/getopt1.c:55:7: [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. char *getenv (); data/fcrackzip-1.0/getopt1.c:63: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/fcrackzip-1.0/getopt1.c:119: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/fcrackzip-1.0/main.c:465: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, "DbBc:hVvp:l:um:2:", options, &option_index)) != -1) data/fcrackzip-1.0/zipinfo.c:169: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, "", options, &option_index)) != -1) data/fcrackzip-1.0/cpmask.c:64:13: [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). img = fopen (name, "rb"); data/fcrackzip-1.0/cpmask.c:381:4: [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 info[80]; data/fcrackzip-1.0/cpmask.c:385:4: [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 (info, "badness %ld", current); data/fcrackzip-1.0/crack.c:14:7: [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. const char *file_path[MAX_FILES]; data/fcrackzip-1.0/crack.c:43:13: [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 *f = fopen (path, "rb"); data/fcrackzip-1.0/crack.c:68:4: [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 zip_path[1024]; data/fcrackzip-1.0/crack.h:36: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. extern const char *file_path[MAX_FILES]; data/fcrackzip-1.0/getopt.c:347:7: [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 var[100]; data/fcrackzip-1.0/getopt.c:348:7: [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 (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); data/fcrackzip-1.0/main.c:143:3: [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 buff[1024]; data/fcrackzip-1.0/main.c:144:3: [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 path[1024]; data/fcrackzip-1.0/main.c:145:3: [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 escpw[256]; data/fcrackzip-1.0/main.c:265:7: [2] (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). Risk is low because the source is a constant string. strcpy (pw, "Martha"); data/fcrackzip-1.0/main.c:286:9: [2] (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). Risk is low because the source is a constant string. strcpy ((char *) p, "abcdefghijklmnopqrstuvwxyz"); data/fcrackzip-1.0/main.c:291:9: [2] (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). Risk is low because the source is a constant string. strcpy ((char *) p, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); data/fcrackzip-1.0/main.c:296:9: [2] (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). Risk is low because the source is a constant string. strcpy ((char *) p, "0123456789"); data/fcrackzip-1.0/main.c:301:9: [2] (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). Risk is low because the source is a constant string. strcpy ((char *) p, "!:$%&/()=?{[]}+-*~#"); data/fcrackzip-1.0/main.c:360:7: [2] (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). Risk is low because the source is a constant string. strcpy (pw, "abcdefghij"); data/fcrackzip-1.0/main.c:523:29: [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). method_number = atoi (optarg); data/fcrackzip-1.0/main.c:628:25: [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 (!(dict_file = fopen (pw, "r"))) data/fcrackzip-1.0/zipinfo.c:45:13: [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 *f = fopen (path, "rb"); data/fcrackzip-1.0/zipinfo.c:70: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 zip_path [1024]; data/fcrackzip-1.0/cpmask.c:347: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). pw_end = pw + strlen (pw); data/fcrackzip-1.0/crack.c:27:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return (fgetc (f) << 0) | data/fcrackzip-1.0/crack.c:28:6: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (fgetc (f) << 8) | data/fcrackzip-1.0/crack.c:29:6: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (fgetc (f) << 16) | data/fcrackzip-1.0/crack.c:30:6: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (fgetc (f) << 24); data/fcrackzip-1.0/crack.c:36:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return (fgetc (f) << 0) | data/fcrackzip-1.0/crack.c:37:6: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (fgetc (f) << 8); data/fcrackzip-1.0/getopt.c:215: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/fcrackzip-1.0/getopt.c:353:24: [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). nonoption_flags_len = strlen (nonoption_flags); data/fcrackzip-1.0/getopt.c:552: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/fcrackzip-1.0/getopt.c:576: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/fcrackzip-1.0/getopt.c:606: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/fcrackzip-1.0/getopt.c:622: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/fcrackzip-1.0/getopt.c:627: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/fcrackzip-1.0/getopt.c:738: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/fcrackzip-1.0/getopt.c:761: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/fcrackzip-1.0/getopt.c:781: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/fcrackzip-1.0/getopt.c:795: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/fcrackzip-1.0/getopt.c:799: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/fcrackzip-1.0/main.c:53: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). size_t len = strlen(str); data/fcrackzip-1.0/main.c:110: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). size_t len = strlen(str); data/fcrackzip-1.0/main.c:233: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). pw[strlen (pw) - 1] = 0; data/fcrackzip-1.0/main.c:477:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (pw, optarg, sizeof(pw)-1); data/fcrackzip-1.0/main.c:519:64: [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 (methods[method_number].desc, optarg, strlen (optarg))) data/fcrackzip-1.0/main.c:611:25: [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). pw_end = pw + strlen (pw); data/fcrackzip-1.0/zipcrack.c:62: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). changed = strlen (pw); data/fcrackzip-1.0/zipinfo.c:25:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = fgetc(f) << 0; data/fcrackzip-1.0/zipinfo.c:26:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r |= fgetc(f) << 8; data/fcrackzip-1.0/zipinfo.c:27:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r |= fgetc(f) << 16; data/fcrackzip-1.0/zipinfo.c:28:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r |= fgetc(f) << 24; data/fcrackzip-1.0/zipinfo.c:37:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = fgetc(f) << 0; data/fcrackzip-1.0/zipinfo.c:38:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r |= fgetc(f) << 8; ANALYSIS SUMMARY: Hits = 73 Lines analyzed = 3189 in approximately 0.16 seconds (19693 lines/second) Physical Source Lines of Code (SLOC) = 2276 Hits@level = [0] 107 [1] 32 [2] 22 [3] 15 [4] 4 [5] 0 Hits@level+ = [0+] 180 [1+] 73 [2+] 41 [3+] 19 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 79.0861 [1+] 32.0738 [2+] 18.0141 [3+] 8.34798 [4+] 1.75747 [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.