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/ffindex-0.9.9.9/ruby18/FFindex.c Examining data/ffindex-0.9.9.9/src/ext/fmemopen.c Examining data/ffindex-0.9.9.9/src/ext/fmemopen.h Examining data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c Examining data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c Examining data/ffindex-0.9.9.9/src/ffindex_from_tsv.c Examining data/ffindex-0.9.9.9/src/ffindex_optimize.c Examining data/ffindex-0.9.9.9/src/ffindex_posix_search.c Examining data/ffindex-0.9.9.9/src/ffindex_posix_search.h Examining data/ffindex-0.9.9.9/src/ffindex_unpack.c Examining data/ffindex-0.9.9.9/src/ffutil.c Examining data/ffindex-0.9.9.9/src/ffutil.h Examining data/ffindex-0.9.9.9/src/nginx/ngx_http_ffindex_module.c Examining data/ffindex-0.9.9.9/src/ffindex_build.c Examining data/ffindex-0.9.9.9/src/ffindex_from_fasta.c Examining data/ffindex-0.9.9.9/src/ffindex.h Examining data/ffindex-0.9.9.9/src/ffindex_get.c Examining data/ffindex-0.9.9.9/src/ffindex_modify.c Examining data/ffindex-0.9.9.9/src/ffindex.c FINAL RESULTS: data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:88:5: [4] (shell) execvp: 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. execvp(program_name, program_argv); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:207:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s [-m] [-q] [-l LOG_FILE] -d DATA_FILENAME_OUT -i INDEX_FILENAME_OUT DATA_FILENAME INDEX_FILENAME -- PROGRAM [PROGRAM_ARGS]*\n" data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:333:10: [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. if(system(merge_command) == 0) data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:205:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s [-m] [-q] [-l LOG_FILE] -d DATA_FILENAME_OUT -i INDEX_FILENAME_OUT DATA_FILENAME INDEX_FILENAME -- PROGRAM [PROGRAM_ARGS]*\n" data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:326:10: [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. if(system(merge_command) == 0) data/ffindex-0.9.9.9/src/ffindex_build.c:35:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s [-a|-v] [-s] [-f file]* OUT_DATA_FILE OUT_INDEX_FILE [-d 2ND_DATA_FILE -i 2ND_INDEX_FILE] [DIR_TO_INDEX|FILE]*\n" data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:34:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s -v | [-s] data_filename index_filename fasta_filename\n" data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:34:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s -v | [-s] [-k INDEX] data_filename index_filename fasta_filename\n" data/ffindex-0.9.9.9/src/ffindex_get.c:28:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s data_filename index_filename entry name(s)\n" data/ffindex-0.9.9.9/src/ffindex_modify.c:33:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s -s|-u [-v] [-f file]* index_filename [filename]*\n" data/ffindex-0.9.9.9/src/ffindex_optimize.c:34:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s OUT_DATA_FILE OUT_INDEX_FILE -d IN_DATA_FILE -i IN_INDEX_FILE\n" data/ffindex-0.9.9.9/src/ffindex_unpack.c:37:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, "USAGE: %s DATA_FILENAME INDEX_FILENAME OUT_DIR\n" data/ffindex-0.9.9.9/src/ffindex.h:81:57: [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. inline size_t ffindex_max_index_entries(){ char *FMIE = getenv("FFINDEX_MAX_INDEX_ENTRIES"); if( FMIE ) { return atol( FMIE ); } else { return FFINDEX_MAX_INDEX_ENTRIES_DEFAULT; } } data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:184: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 ((opt = getopt(argn, argv, "d:i:mql:")) != -1) data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:182: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 ((opt = getopt(argn, argv, "d:i:mql:")) != -1) data/ffindex-0.9.9.9/src/ffindex_build.c:74: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 ((opt = getopt(argn, argv, "asuvd:f:hi:")) != -1) data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:49: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 ((opt = getopt(argn, argv, "sinv")) != -1) data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:67: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 ((opt = getopt(argn, argv, "svk:")) != -1) data/ffindex-0.9.9.9/src/ffindex_get.c:45: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 ((opt = getopt(argn, argv, "f:hn")) != -1) data/ffindex-0.9.9.9/src/ffindex_modify.c:53: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 ((opt = getopt(argn, argv, "stuvf:")) != -1) data/ffindex-0.9.9.9/src/ffindex_optimize.c:51: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 ((opt = getopt(argn, argv, "vd:i:")) != -1) data/ffindex-0.9.9.9/ruby18/FFindex.c:56:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ffindex_db->ffdata_filename, StringValuePtr(ffdata_filename), RSTRING_LEN(ffdata_filename)); data/ffindex-0.9.9.9/ruby18/FFindex.c:59:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ffindex_db->ffindex_filename, StringValuePtr(ffindex_filename), RSTRING_LEN(ffindex_filename)); data/ffindex-0.9.9.9/ruby18/FFindex.c:90:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(name, StringValuePtr(key), RSTRING_LEN(key)); data/ffindex-0.9.9.9/src/ffindex.c:118:23: [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). *out_data_file = fopen(data_filename, "a"); data/ffindex-0.9.9.9/src/ffindex.c:121:23: [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). *out_index_file = fopen(index_filename, "a+"); data/ffindex-0.9.9.9/src/ffindex.c:134:23: [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). *out_data_file = fopen(data_filename, "r"); data/ffindex-0.9.9.9/src/ffindex.c:137:23: [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). *out_index_file = fopen(index_filename, "r"); data/ffindex-0.9.9.9/src/ffindex.c:147:23: [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). *out_data_file = fopen(data_filename, "w"); data/ffindex-0.9.9.9/src/ffindex.c:151:23: [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). *out_index_file = fopen(index_filename, "w+"); data/ffindex-0.9.9.9/src/ffindex.c:177: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 buffer[1] = {'\0'}; data/ffindex-0.9.9.9/src/ffindex.c:199: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[PATH_MAX]; data/ffindex-0.9.9.9/src/ffindex.c:220: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[PATH_MAX]; data/ffindex-0.9.9.9/src/ffindex.c:254: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). FILE *file = fopen(path, "r"); data/ffindex-0.9.9.9/src/ffindex.c:268: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 buffer[FFINDEX_BUFFER_SIZE]; data/ffindex-0.9.9.9/src/ffindex.c:597: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). FILE* index_file = fopen(index_filename, "r"); data/ffindex-0.9.9.9/src/ffindex.c:611: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). index_file = fopen(index_filename, "w"); data/ffindex-0.9.9.9/src/ffindex.h:39: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 name[FFINDEX_MAX_ENTRY_NAME_LENTH + 1]; data/ffindex-0.9.9.9/src/ffindex.h:65: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 mode[3]; data/ffindex-0.9.9.9/src/ffindex.h:81:114: [2] (integer) atol: 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). inline size_t ffindex_max_index_entries(){ char *FMIE = getenv("FFINDEX_MAX_INDEX_ENTRIES"); if( FMIE ) { return atol( FMIE ); } else { return FFINDEX_MAX_INDEX_ENTRIES_DEFAULT; } } data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:228: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). FILE *data_file = fopen(data_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:229: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). FILE *index_file = fopen(index_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:243: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). data_file_out = fopen(data_filename_out_rank, "w+"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:244: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). index_file_out = fopen(index_filename_out_rank, "w+"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:255: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). log_file = fopen(log_filename_rank, "w+"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:225: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). FILE *data_file = fopen(data_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:226: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). FILE *index_file = fopen(index_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:240: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). data_file_out = fopen(data_filename_out_rank, "w+"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:241: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). index_file_out = fopen(index_filename_out_rank, "w+"); data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:252: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). log_file = fopen(log_filename_rank, "w+"); data/ffindex-0.9.9.9/src/ffindex_build.c:148: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). FILE *list_file = fopen(list_filenames[i], "r"); data/ffindex-0.9.9.9/src/ffindex_build.c:162:33: [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* data_file_to_add = fopen(list_ffindex_data[i], "r"); if( data_file_to_add == NULL) { perror(list_ffindex_data[i]); return EXIT_FAILURE; } data/ffindex-0.9.9.9/src/ffindex_build.c:163:33: [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* index_file_to_add = fopen(list_ffindex_index[i], "r"); if( index_file_to_add == NULL) { perror(list_ffindex_index[i]); return EXIT_FAILURE; } data/ffindex-0.9.9.9/src/ffindex_build.c:208: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). index_file = fopen(index_filename, "w"); data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:95: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). fasta_file = fopen(fasta_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:101: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 name[FFINDEX_MAX_ENTRY_NAME_LENTH]; data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:120: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(name, "%d", seq_id++); data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:137: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). index_file = fopen(index_filename, "w"); data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:111:20: [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* tsv_file = fopen(tsv_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:120: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 field_current[FFINDEX_MAX_ENTRY_NAME_LENTH + 1]; // + seperator data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:163: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). index_file = fopen(index_filename, "w"); data/ffindex-0.9.9.9/src/ffindex_get.c:88:24: [2] (integer) atol: 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). size_t index_n = atol(argv[i]) - 1; // offset from 0 but specify from 1 data/ffindex-0.9.9.9/src/ffindex_get.c:116:27: [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 *list_file = fopen(list_filenames[i], "r"); data/ffindex-0.9.9.9/src/ffindex_get.c:119: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 name[PATH_MAX]; data/ffindex-0.9.9.9/src/ffindex_modify.c:95: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). index_file = fopen(index_filename, "r+"); data/ffindex-0.9.9.9/src/ffindex_modify.c:119:29: [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 *list_file = fopen(list_filenames[i], "r"); data/ffindex-0.9.9.9/src/ffindex_modify.c:123:11: [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[PATH_MAX]; data/ffindex-0.9.9.9/src/ffindex_modify.c:140: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). index_file = fopen(index_filename, "w"); data/ffindex-0.9.9.9/src/ffindex_optimize.c:107: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). FILE *list_file = fopen(list_filenames[i], "r"); data/ffindex-0.9.9.9/src/ffindex_optimize.c:121:33: [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* data_file_to_add = fopen(list_ffindex_data[i], "r"); if( data_file_to_add == NULL) { perror(list_ffindex_data[i]); return EXIT_FAILURE; } data/ffindex-0.9.9.9/src/ffindex_optimize.c:122:33: [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* index_file_to_add = fopen(list_ffindex_index[i], "r"); if( index_file_to_add == NULL) { perror(list_ffindex_index[i]); return EXIT_FAILURE; } data/ffindex-0.9.9.9/src/ffindex_optimize.c:166: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). index_file = fopen(index_filename, "w"); data/ffindex-0.9.9.9/src/ffindex_unpack.c:47: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). FILE *data_file = fopen(data_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_unpack.c:48: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). FILE *index_file = fopen(index_filename, "r"); data/ffindex-0.9.9.9/src/ffindex_unpack.c:78: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). FILE *output_file = fopen(entry->name, "w"); data/ffindex-0.9.9.9/src/ffutil.c:84: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 p[21]; data/ffindex-0.9.9.9/src/ffutil.c:98: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). FILE *fp = fopen(filename, "r"); data/ffindex-0.9.9.9/src/nginx/ngx_http_ffindex_module.c:121:34: [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). child_config->ffdata_file = fopen(child_config->ffdata_filename.data, "r"); data/ffindex-0.9.9.9/src/nginx/ngx_http_ffindex_module.c:122:34: [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). child_config->ffindex_file = fopen(child_config->ffindex_filename.data, "r"); data/ffindex-0.9.9.9/src/nginx/ngx_http_ffindex_module.c:170:20: [2] (integer) atol: 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). size_t index = atol(req->args.data + sizeof("get_data_by_index=")) + 1; // index from 0 request from 1 data/ffindex-0.9.9.9/src/ffindex.c:221:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, input_dir_name, NAME_MAX); data/ffindex-0.9.9.9/src/ffindex.c:234:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path + input_dir_name_len, entry->d_name, NAME_MAX); data/ffindex-0.9.9.9/src/ffindex.c:368:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(search.name, name, FFINDEX_MAX_ENTRY_NAME_LENTH); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:131:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t r = read(pipefd_stdout[0], b, PIPE_BUF); data/ffindex-0.9.9.9/src/ffindex_apply_mpi.c:143:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((r = read(pipefd_stdout[0], b, PIPE_BUF)) > 0) data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:134:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t r = read(pipefd_stdout[0], b, PIPE_BUF); data/ffindex-0.9.9.9/src/ffindex_apply_mpi_spawn.c:146:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((r = read(pipefd_stdout[0], b, PIPE_BUF)) > 0) data/ffindex-0.9.9.9/src/ffindex_from_fasta.c:116:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, fasta_data + (fasta_offset + 1 - from_length), len); data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:126:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(field_current, tsv_selected_field_start, tsv_selected_field_length); //XXX data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:137:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(field_current, tsv_selected_field_start, tsv_selected_field_length); //XXX data/ffindex-0.9.9.9/src/ffindex_from_tsv.c:145:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(field_current, tsv_selected_field_start, tsv_selected_field_length); //XXX data/ffindex-0.9.9.9/src/ffindex_posix_search.c:13:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(search.name, name, FFINDEX_MAX_ENTRY_NAME_LENTH); data/ffindex-0.9.9.9/src/ffindex_posix_search.c:26:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(search.name, name_to_unlink, FFINDEX_MAX_ENTRY_NAME_LENTH); data/ffindex-0.9.9.9/src/ffutil.c:105:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(fp); ANALYSIS SUMMARY: Hits = 94 Lines analyzed = 3393 in approximately 0.16 seconds (20569 lines/second) Physical Source Lines of Code (SLOC) = 2387 Hits@level = [0] 47 [1] 14 [2] 59 [3] 9 [4] 12 [5] 0 Hits@level+ = [0+] 141 [1+] 94 [2+] 80 [3+] 21 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 59.07 [1+] 39.38 [2+] 33.5149 [3+] 8.79765 [4+] 5.02723 [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.