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/gztool-0.11.5.0/gztool.c

FINAL RESULTS:

data/gztool-0.11.5.0/gztool.c:183:8:  [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.
struct access {
data/gztool-0.11.5.0/gztool.c:234:9:  [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, format, args );
data/gztool-0.11.5.0/gztool.c:572:30:  [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.
local void free_index(struct access *index)
data/gztool-0.11.5.0/gztool.c:592:36:  [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.
local void empty_index_list(struct access *index, uint64_t from, uint64_t to)
data/gztool-0.11.5.0/gztool.c:607: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.
local struct access *create_empty_index()
data/gztool-0.11.5.0/gztool.c:609:12:  [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.
    struct access *index;
data/gztool-0.11.5.0/gztool.c:610:49:  [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 ( NULL == ( index = malloc(sizeof(struct access)) ) ) {
data/gztool-0.11.5.0/gztool.c:650: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.
local struct access *addpoint( struct access *index, uint32_t bits,
data/gztool-0.11.5.0/gztool.c:650:39:  [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.
local struct access *addpoint( struct access *index, uint32_t bits,
data/gztool-0.11.5.0/gztool.c:736:56:  [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.
int serialize_index_to_file( FILE *output_file, struct access *index, uint64_t index_last_written_point ) {
data/gztool-0.11.5.0/gztool.c:761:13:  [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(output_file, GZIP_INDEX_IDENTIFIER_STRING);
data/gztool-0.11.5.0/gztool.c:763:13:  [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(output_file, GZIP_INDEX_IDENTIFIER_STRING_V1);
data/gztool-0.11.5.0/gztool.c:876:30:  [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.
int check_index_file( struct access *index, char *file_name, char *index_filename ) {
data/gztool-0.11.5.0/gztool.c:973:75:  [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.
    FILE *file_in, FILE *file_out, char *file_name, uint64_t span, struct access **built,
data/gztool-0.11.5.0/gztool.c:989:12:  [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.
    struct access *index = NULL;/* access points being generated */
data/gztool-0.11.5.0/gztool.c:1043:22:  [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( index_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:2053:8:  [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.
struct access *deserialize_index_from_file(
data/gztool-0.11.5.0/gztool.c:2058:12:  [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.
    struct access *index = NULL;
data/gztool-0.11.5.0/gztool.c:2498:12:  [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.
    struct access **built, char *index_filename, int write_index_to_disk,
data/gztool-0.11.5.0/gztool.c:2504:12:  [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.
    struct access *index = NULL;/* access points being generated */
data/gztool-0.11.5.0/gztool.c:2556:18:  [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( index_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:2892:29:  [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.
    char *file_name, struct access **index,
data/gztool-0.11.5.0/gztool.c:2957:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf( out_filename, "%s.gz", file_name );
data/gztool-0.11.5.0/gztool.c:2959:18:  [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( out_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:3014: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.
             access( index_filename, F_OK ) != -1 &&
data/gztool-0.11.5.0/gztool.c:3080:17:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                sprintf(output_filename, "%s", file_name);
data/gztool-0.11.5.0/gztool.c:3084:22:  [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( output_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:3194:12:  [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.
    struct access *index = NULL;
data/gztool-0.11.5.0/gztool.c:3209:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf( gzip_filename, "%s", input_gzip_filename );
data/gztool-0.11.5.0/gztool.c:3247:21:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                    sprintf( gzip_filename, "%s", file_name );
data/gztool-0.11.5.0/gztool.c:3254:30:  [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( gzip_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:3260:34:  [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( gzip_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:3278:21:  [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( gzip_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:3655:12:  [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.
    struct access *index = NULL;
data/gztool-0.11.5.0/gztool.c:4119: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.
             access( index_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:4357:17:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                sprintf( index_filename, "%s", argv[i] );
data/gztool-0.11.5.0/gztool.c:4360:21:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                    sprintf(index_filename, "%s.gzi", argv[i]);
data/gztool-0.11.5.0/gztool.c:4367:25:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                        sprintf(index_filename, "%si", argv[i]);
data/gztool-0.11.5.0/gztool.c:4370:25:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                        sprintf(index_filename, "%s.gzi", argv[i]);
data/gztool-0.11.5.0/gztool.c:4394:18:  [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.
                 access( index_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:4523:30:  [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( file_name, F_OK ) != -1 &&
data/gztool-0.11.5.0/gztool.c:4535:34:  [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( index_filename, F_OK ) != -1 ) {
data/gztool-0.11.5.0/gztool.c:4619:29:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                            sprintf(output_filename, "%s", file_name);
data/gztool-0.11.5.0/gztool.c:3690:19:  [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, "a:b:cCdDeEfFhiI:lL:n:s:StTu:v:wWxX")) != -1)
data/gztool-0.11.5.0/gztool.c:225:1:  [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 number_output[MAX_giveMeSIUnits_RETURNED_LENGTH];
data/gztool-0.11.5.0/gztool.c:254: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 *SI_UNITS[7] =
data/gztool-0.11.5.0/gztool.c:256: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 *SI_BINARY_UNITS[7] =
data/gztool-0.11.5.0/gztool.c:355:9:  [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(endian_ptr, ptr, size);
data/gztool-0.11.5.0/gztool.c:423:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        if ( memcpy(in, source + i, strm.avail_in) == NULL ) {
data/gztool-0.11.5.0/gztool.c:441:26:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                 NULL == memcpy(out_complete + output_size, out, have)
data/gztool-0.11.5.0/gztool.c:512:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        if ( memcpy(in, source + i, strm.avail_in) == NULL ) {
data/gztool-0.11.5.0/gztool.c:538:26:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                 NULL == memcpy(out_complete + output_size, out, have)
data/gztool-0.11.5.0/gztool.c:694:17:  [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(next->window, window + window_size - left, left);
data/gztool-0.11.5.0/gztool.c:696:17:  [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(next->window + left, window, window_size - left);
data/gztool-0.11.5.0/gztool.c:1003: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 input[CHUNK];    // TODO: convert to malloc
data/gztool-0.11.5.0/gztool.c:1004: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 window[WINSIZE]; // TODO: convert to malloc
data/gztool-0.11.5.0/gztool.c:1006: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 window2[WINSIZE];// TODO: convert to malloc
data/gztool-0.11.5.0/gztool.c:1048: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).
                    index_file = fopen( index_filename, "r+b" );
data/gztool-0.11.5.0/gztool.c:1052: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).
                    index_file = fopen( index_filename, "w+b" );
data/gztool-0.11.5.0/gztool.c:1057:30:  [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, "rb" );
data/gztool-0.11.5.0/gztool.c:1236:39:  [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 (NULL == (index_file = fopen(index->file_name, "rb")) ||
data/gztool-0.11.5.0/gztool.c:1612:25:  [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( window2, window, window2_size );
data/gztool-0.11.5.0/gztool.c:2063: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 header[GZIP_INDEX_HEADER_SIZE];
data/gztool-0.11.5.0/gztool.c:2252:18:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
         NULL == memcpy( index->file_name, file_name, strlen(file_name) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:2563:30:  [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+b" );
data/gztool-0.11.5.0/gztool.c:2924: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_in = fopen( file_name, "rb" );
data/gztool-0.11.5.0/gztool.c:2968:24:  [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_out = fopen( out_filename, "w+b" );
data/gztool-0.11.5.0/gztool.c:2997:30:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                     NULL == memcpy( (*index)->file_name, index_filename, strlen(index_filename) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:3020:30:  [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, "rb" );
data/gztool-0.11.5.0/gztool.c:3045:30:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                     NULL == memcpy( (*index)->file_name, index_filename, strlen(index_filename) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:3092:28:  [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_out = fopen( output_filename, "wb" );
data/gztool-0.11.5.0/gztool.c:3125:30:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                     NULL == memcpy( (*index)->file_name, index_filename, strlen(index_filename) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:3216: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).
        in = fopen( file_name, "rb" );
data/gztool-0.11.5.0/gztool.c:3511:5:  [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(input, original_input, strlen(original_input) +1);
data/gztool-0.11.5.0/gztool.c:3517:19:  [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.
            if ( (char *)strchr(input, PowerSuffixes[i]) == (char *)(input + strlen(input) -1) ) {
data/gztool-0.11.5.0/gztool.c:3759:17:  [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( index_filename, optarg, strlen(optarg) + 1 );
data/gztool-0.11.5.0/gztool.c:4475:40:  [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 ( NULL == (in = fopen( file_name, "rb" )) ) {
data/gztool-0.11.5.0/gztool.c:4490:40:  [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 ( NULL == (in = fopen( file_name, "rb" )) ) {
data/gztool-0.11.5.0/gztool.c:879: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).
         strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:1024: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).
            if ( strlen(index_filename) > 0 )
data/gztool-0.11.5.0/gztool.c:1035: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).
    if ( strlen(index_filename) > 0 &&
data/gztool-0.11.5.0/gztool.c:1215:21:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                i = getc(file_in);
data/gztool-0.11.5.0/gztool.c:1231: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).
                strlen(index->file_name) == 0 ) {
data/gztool-0.11.5.0/gztool.c:1304:22:  [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 ( strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:1424: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).
            if ( strlen( file_name ) > 0 ) {    // this check cannot be done on STDIN
data/gztool-0.11.5.0/gztool.c:1955: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).
            if ( strlen(index_filename) > 0 )
data/gztool-0.11.5.0/gztool.c:2069: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).
    if ( strlen(file_name) > 0 ) {
data/gztool-0.11.5.0/gztool.c:2250:32:  [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).
    index->file_name = malloc( strlen(file_name) + 1 );
data/gztool-0.11.5.0/gztool.c:2252:55:  [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).
         NULL == memcpy( index->file_name, file_name, strlen(file_name) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:2553: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).
    if ( strlen(index_filename) > 0 ) {
data/gztool-0.11.5.0/gztool.c:2694: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).
            if ( strlen( file_name ) > 0 ) {    // this check cannot be done on STDIN
data/gztool-0.11.5.0/gztool.c:2758:14:  [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 ( strlen(index_filename) > 0 )
data/gztool-0.11.5.0/gztool.c:2907: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).
    if ( strlen(file_name) == 0 &&
data/gztool-0.11.5.0/gztool.c:2908: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).
         strlen(index_filename) == 0 &&
data/gztool-0.11.5.0/gztool.c:2922: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).
    if ( strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:2954:14:  [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 ( strlen(file_name) > 0 ) {
data/gztool-0.11.5.0/gztool.c:2956:36:  [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).
            out_filename = malloc( strlen(file_name) + 3 + 1 );
data/gztool-0.11.5.0/gztool.c:2995: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).
                (*index)->file_name = malloc( strlen(index_filename) + 1 );
data/gztool-0.11.5.0/gztool.c:2997:75:  [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).
                     NULL == memcpy( (*index)->file_name, index_filename, strlen(index_filename) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:3013:14:  [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 ( strlen( index_filename ) > 0 &&
data/gztool-0.11.5.0/gztool.c:3043: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).
                (*index)->file_name = malloc( strlen(index_filename) + 1 );
data/gztool-0.11.5.0/gztool.c:3045:75:  [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).
                     NULL == memcpy( (*index)->file_name, index_filename, strlen(index_filename) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:3057:14:  [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).
             strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:3074: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).
            if ( strlen( file_name ) > 3 && // avoid out-of-bounds
data/gztool-0.11.5.0/gztool.c:3076: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).
                 (char *)(file_name + strlen(file_name) - 3)
data/gztool-0.11.5.0/gztool.c:3079:49:  [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).
                char *output_filename = malloc( strlen(file_name) );
data/gztool-0.11.5.0/gztool.c:3081: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).
                output_filename[strlen(file_name) - 3] = '\0';
data/gztool-0.11.5.0/gztool.c:3123: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).
                (*index)->file_name = malloc( strlen(index_filename) + 1 );
data/gztool-0.11.5.0/gztool.c:3125:75:  [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).
                     NULL == memcpy( (*index)->file_name, index_filename, strlen(index_filename) + 1 ) ) {
data/gztool-0.11.5.0/gztool.c:3149:22:  [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 ( strlen(file_name) > 0 )
data/gztool-0.11.5.0/gztool.c:3155:22:  [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 ( strlen(file_name) > 0 )
data/gztool-0.11.5.0/gztool.c:3206: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).
        gzip_filename = malloc( strlen(input_gzip_filename) + 1 );
data/gztool-0.11.5.0/gztool.c:3213: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).
    if ( strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:3233: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).
         strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:3245:41:  [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).
                gzip_filename = malloc( strlen(file_name) + 1 );
data/gztool-0.11.5.0/gztool.c:3248:26:  [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 ( strlen( file_name ) > 4 && // avoid out-of-bounds
data/gztool-0.11.5.0/gztool.c:3250:54:  [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).
                            (char *)(gzip_filename + strlen(file_name) - 4) ) {
data/gztool-0.11.5.0/gztool.c:3252: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).
                        gzip_filename[strlen(gzip_filename)-1]='\0';
data/gztool-0.11.5.0/gztool.c:3259:43:  [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).
                            gzip_filename[strlen(gzip_filename)-3]='\0';
data/gztool-0.11.5.0/gztool.c:3307:14:  [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 ( strlen( file_name ) > 0 ) {
data/gztool-0.11.5.0/gztool.c:3503:36:  [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 PowerSuffixesLength = strlen(PowerSuffixes)/2;
data/gztool-0.11.5.0/gztool.c:3510: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).
    input = malloc( strlen(original_input) +1 );
data/gztool-0.11.5.0/gztool.c:3511:35:  [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).
    memcpy(input, original_input, strlen(original_input) +1);
data/gztool-0.11.5.0/gztool.c:3513: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).
    if ( strlen(input) > 1 ) {
data/gztool-0.11.5.0/gztool.c:3516:22:  [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).
        for ( i=0; i<strlen(PowerSuffixes); i++ ) {
data/gztool-0.11.5.0/gztool.c:3517:78:  [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 ( (char *)strchr(input, PowerSuffixes[i]) == (char *)(input + strlen(input) -1) ) {
data/gztool-0.11.5.0/gztool.c:3523:23:  [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).
                input[strlen(input) -1] = '\0';
data/gztool-0.11.5.0/gztool.c:3530: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).
    if ( strlen(input) > 1 ) {
data/gztool-0.11.5.0/gztool.c:3534: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).
            if ( strlen(input) > 2 &&
data/gztool-0.11.5.0/gztool.c:3702: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).
                     ( strlen( optarg ) != 1 || '0' != optarg[0] ) ) {
data/gztool-0.11.5.0/gztool.c:3758:42:  [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).
                index_filename = malloc( strlen(optarg) + 1 );
data/gztool-0.11.5.0/gztool.c:3759:49:  [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).
                memcpy( index_filename, optarg, strlen(optarg) + 1 );
data/gztool-0.11.5.0/gztool.c:3817:22:  [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 ( strlen(optarg) == 1 ) {
data/gztool-0.11.5.0/gztool.c:3854:22:  [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).
                     strlen( optarg ) > 1 ||
data/gztool-0.11.5.0/gztool.c:4356:42:  [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).
                index_filename = malloc( strlen(argv[i]) + 4 + 1 );
data/gztool-0.11.5.0/gztool.c:4362:26:  [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 ( strlen( argv[i] ) > 3 && // avoid out-of-bounds
data/gztool-0.11.5.0/gztool.c:4364:52:  [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).
                         (char *)(index_filename + strlen(argv[i]) - 3)
data/gztool-0.11.5.0/gztool.c:4524: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).
                            ( ( strlen( file_name ) > 4 && // avoid out-of-bounds
data/gztool-0.11.5.0/gztool.c:4526:54:  [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).
                                (char *)(file_name + strlen(argv[i]) - 4) )
data/gztool-0.11.5.0/gztool.c:4528: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).
                            strlen( file_name ) <= 4 )
data/gztool-0.11.5.0/gztool.c:4613:30:  [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 ( strlen( file_name ) > 3 && // avoid out-of-bounds
data/gztool-0.11.5.0/gztool.c:4615: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).
                             (char *)(file_name + strlen(file_name) - 3)
data/gztool-0.11.5.0/gztool.c:4618:61:  [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).
                            char *output_filename = malloc( strlen(file_name) );
data/gztool-0.11.5.0/gztool.c:4620:45:  [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).
                            output_filename[strlen(file_name) - 3] = '\0';

ANALYSIS SUMMARY:

Hits = 144
Lines analyzed = 4701 in approximately 0.16 seconds (29827 lines/second)
Physical Source Lines of Code (SLOC) = 3271
Hits@level = [0] 123 [1]  66 [2]  34 [3]   1 [4]  43 [5]   0
Hits@level+ = [0+] 267 [1+] 144 [2+]  78 [3+]  44 [4+]  43 [5+]   0
Hits/KSLOC@level+ = [0+] 81.6264 [1+] 44.0232 [2+] 23.8459 [3+] 13.4515 [4+] 13.1458 [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.