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/fortunes-es-1.36/util/randstr.c Examining data/fortunes-es-1.36/util/rot.c Examining data/fortunes-es-1.36/util/strfile.c Examining data/fortunes-es-1.36/util/strfile.h Examining data/fortunes-es-1.36/util/unstr.c FINAL RESULTS: data/fortunes-es-1.36/util/randstr.c:125:6: [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(Datafile, Infile); data/fortunes-es-1.36/util/randstr.c:130:6: [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(Datafile, Infile); data/fortunes-es-1.36/util/strfile.c:213:13: [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). (void) strcpy(Outfile, *argv); data/fortunes-es-1.36/util/strfile.c:222:2: [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(Outfile, Infile); data/fortunes-es-1.36/util/unstr.c:145:6: [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(Datafile, Infile); data/fortunes-es-1.36/util/unstr.c:150:6: [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(Datafile, Infile); data/fortunes-es-1.36/util/unstr.c:156:6: [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(Outfile, *av); data/fortunes-es-1.36/util/randstr.c:151:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. pos = random() % fp->str_numstr; data/fortunes-es-1.36/util/randstr.c:164:14: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. choice = random() % fp.str_numstr; data/fortunes-es-1.36/util/randstr.c:216:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((int) (time((time_t *) NULL) + getpid())); data/fortunes-es-1.36/util/strfile.c:177:18: [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 ((ch = getopt(argc, argv, "c:iorsx")) != EOF) data/fortunes-es-1.36/util/strfile.c:382:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((int) (time((time_t *) NULL) + getpid())); data/fortunes-es-1.36/util/strfile.c:396:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. i = random() % cnt; data/fortunes-es-1.36/util/unstr.c:121:18: [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 ((ch = getopt(ac, av, "c:")) != EOF) data/fortunes-es-1.36/util/randstr.c:126:6: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(Datafile, ".dat"); data/fortunes-es-1.36/util/randstr.c:176: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 line[BUFSIZ]; data/fortunes-es-1.36/util/randstr.c:199:16: [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 ((Inf = fopen(Infile, "r")) == NULL) data/fortunes-es-1.36/util/randstr.c:204: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). if ((Dataf = fopen(Datafile, "r")) == NULL) data/fortunes-es-1.36/util/strfile.c:223:2: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(Outfile, ".dat"); data/fortunes-es-1.36/util/strfile.c:330: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). Sort_1 = fopen(Infile, "r"); data/fortunes-es-1.36/util/strfile.c:331: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). Sort_2 = fopen(Infile, "r"); data/fortunes-es-1.36/util/strfile.c:349: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 buf[3]; data/fortunes-es-1.36/util/strfile.c:420: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 string[257]; data/fortunes-es-1.36/util/strfile.c:423:16: [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 ((inf = fopen(Infile, "r")) == NULL) data/fortunes-es-1.36/util/strfile.c:429:17: [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 ((outf = fopen(Outfile, "w")) == NULL) data/fortunes-es-1.36/util/unstr.c:146:6: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(Datafile, ".dat"); data/fortunes-es-1.36/util/unstr.c:179:5: [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[BUFSIZ]; data/fortunes-es-1.36/util/unstr.c:210:16: [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 ((Inf = fopen(Infile, "r")) == NULL) data/fortunes-es-1.36/util/unstr.c:215: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). if ((Dataf = fopen(Datafile, "r")) == NULL) data/fortunes-es-1.36/util/unstr.c:222:22: [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). else if ((Outf = fopen(Outfile, "w+")) == NULL) data/fortunes-es-1.36/util/rot.c:13:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((a = getchar()) != EOF) data/fortunes-es-1.36/util/strfile.c:291:26: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (!isalnum(c1 = getc(Sort_1)) && c1 != '\0') data/fortunes-es-1.36/util/strfile.c:293:26: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (!isalnum(c2 = getc(Sort_2)) && c2 != '\0') data/fortunes-es-1.36/util/strfile.c:309:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c1 = getc(Sort_1); data/fortunes-es-1.36/util/strfile.c:310:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c2 = getc(Sort_2); data/fortunes-es-1.36/util/strfile.c:454:38: [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). length = pos - last_off - (sp ? strlen(sp) : 0); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 1096 in approximately 0.07 seconds (15978 lines/second) Physical Source Lines of Code (SLOC) = 635 Hits@level = [0] 25 [1] 6 [2] 16 [3] 7 [4] 7 [5] 0 Hits@level+ = [0+] 61 [1+] 36 [2+] 30 [3+] 14 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 96.063 [1+] 56.6929 [2+] 47.2441 [3+] 22.0472 [4+] 11.0236 [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.