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/fiche-0.9.1/fiche.c Examining data/fiche-0.9.1/fiche.h Examining data/fiche-0.9.1/main.c FINAL RESULTS: data/fiche-0.9.1/fiche.c:247:14: [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. if ( access(settings.output_dir_path, W_OK) != 0 ) { data/fiche-0.9.1/fiche.c:261:14: [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. if ( access(settings.log_file_path, W_OK) != 0 ) { data/fiche-0.9.1/fiche.c:296:5: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/fiche-0.9.1/fiche.c:308:5: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/fiche-0.9.1/fiche.c:378:5: [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(b, prefix); data/fiche-0.9.1/fiche.c:379:5: [4] (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). strcat(b, settings->domain); data/fiche-0.9.1/main.c:47:17: [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 ((c = getopt(argc, argv, "D6eSp:b:s:d:o:l:B:u:w:")) != -1) { data/fiche-0.9.1/fiche.c:228: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 date[64]; data/fiche-0.9.1/fiche.c:257:19: [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(settings.log_file_path, "a+"); data/fiche-0.9.1/fiche.c:328:15: [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(s->log_file_path, "a"); data/fiche-0.9.1/fiche.c:334: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 date[64]; data/fiche-0.9.1/fiche.c:542: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 hostname[1024]; data/fiche-0.9.1/fiche.c:548: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(hostname, "n/a"); data/fiche-0.9.1/fiche.c:553: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 date[64]; data/fiche-0.9.1/fiche.c:658: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 url[len]; data/fiche-0.9.1/fiche.c:757:15: [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, "w"); data/fiche-0.9.1/main.c:60:27: [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). fs.port = atoi(optarg); data/fiche-0.9.1/main.c:67:31: [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). fs.slug_len = atoi(optarg); data/fiche-0.9.1/main.c:88:33: [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). fs.buffer_len = atoi(optarg); data/fiche-0.9.1/fiche.c:359: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). buf[strlen(buf)-1] = 0; data/fiche-0.9.1/fiche.c:371: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). const int len = strlen(settings->domain) + strlen(prefix) + 1; data/fiche-0.9.1/fiche.c:371:48: [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(settings->domain) + strlen(prefix) + 1; data/fiche-0.9.1/fiche.c:656:28: [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 size_t len = strlen(c->settings->domain) + strlen(slug) + 3; data/fiche-0.9.1/fiche.c:656:58: [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 size_t len = strlen(c->settings->domain) + strlen(slug) + 3; data/fiche-0.9.1/fiche.c:705:33: [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). int n = rand_r(&seed) % strlen(Fiche_Symbols); data/fiche-0.9.1/fiche.c:718: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). size_t len = strlen(output_dir) + strlen(slug) + 2; data/fiche-0.9.1/fiche.c:718:39: [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(output_dir) + strlen(slug) + 2; data/fiche-0.9.1/fiche.c:746: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). size_t len = strlen(s->output_dir_path) + strlen(slug) + strlen(file_name) + 3; data/fiche-0.9.1/fiche.c:746:47: [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(s->output_dir_path) + strlen(slug) + strlen(file_name) + 3; data/fiche-0.9.1/fiche.c:746:62: [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(s->output_dir_path) + strlen(slug) + strlen(file_name) + 3; ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 1030 in approximately 0.04 seconds (23360 lines/second) Physical Source Lines of Code (SLOC) = 464 Hits@level = [0] 15 [1] 11 [2] 12 [3] 1 [4] 6 [5] 0 Hits@level+ = [0+] 45 [1+] 30 [2+] 19 [3+] 7 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 96.9828 [1+] 64.6552 [2+] 40.9483 [3+] 15.0862 [4+] 12.931 [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.