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/lzlib-1.11/cbuffer.c Examining data/lzlib-1.11/encoder_base.c Examining data/lzlib-1.11/fast_encoder.c Examining data/lzlib-1.11/encoder_base.h Examining data/lzlib-1.11/lzlib.h Examining data/lzlib-1.11/fast_encoder.h Examining data/lzlib-1.11/lzlib.c Examining data/lzlib-1.11/carg_parser.c Examining data/lzlib-1.11/lzip.h Examining data/lzlib-1.11/carg_parser.h Examining data/lzlib-1.11/lzcheck.c Examining data/lzlib-1.11/encoder.h Examining data/lzlib-1.11/decoder.c Examining data/lzlib-1.11/main.c Examining data/lzlib-1.11/bbexample.c Examining data/lzlib-1.11/encoder.c Examining data/lzlib-1.11/decoder.h FINAL RESULTS: data/lzlib-1.11/main.c:364:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy( output_filename, name ); data/lzlib-1.11/main.c:367: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( output_filename, known_extensions[0].from ); data/lzlib-1.11/main.c:382:7: [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( output_filename, name ); data/lzlib-1.11/main.c:383:7: [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( output_filename + name_len - from_len, known_extensions[eindex].to ); data/lzlib-1.11/main.c:388:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy( output_filename, name ); data/lzlib-1.11/main.c:1081: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). strcpy( output_filename, default_output_filename ); data/lzlib-1.11/bbexample.c:36: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 * const f = fopen( name, "rb" ); data/lzlib-1.11/carg_parser.c:160: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 code_str[2]; data/lzlib-1.11/cbuffer.c:94:24: [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( out_buffer ) memcpy( out_buffer, cb->buffer + cb->get, size ); data/lzlib-1.11/cbuffer.c:104:24: [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( out_buffer ) memcpy( out_buffer + size, cb->buffer + cb->get, size2 ); data/lzlib-1.11/cbuffer.c:127:7: [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( cb->buffer + cb->put, in_buffer, size ); data/lzlib-1.11/cbuffer.c:137:7: [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( cb->buffer + cb->put, in_buffer + size, size2 ); data/lzlib-1.11/decoder.h:362:7: [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( d->cb.buffer + lpos, d->cb.buffer + i, len ); data/lzlib-1.11/encoder_base.h:293: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( mb->buffer + mb->stream_pos, inbuf, sz ); data/lzlib-1.11/lzcheck.c:236: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 * file = fopen( argv[i], "rb" ); data/lzlib-1.11/lzip.h:204: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( data, lzip_magic, 4 ); data[4] = 1; } data/lzlib-1.11/main.c:251: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. const char * const prefix[8] = data/lzlib-1.11/main.c:365:19: [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. if( multifile ) strcat( output_filename, "00001" ); data/lzlib-1.11/main.c:389:3: [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( output_filename, ".out" ); data/lzlib-1.11/main.c:409:12: [2] (misc) open: 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). infd = open( name, O_RDONLY | O_BINARY ); data/lzlib-1.11/main.c:444:11: [2] (misc) open: 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). outfd = open( output_filename, flags, outfd_mode ); data/lzlib-1.11/carg_parser.c:38:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const int len = strlen( argument ); data/lzlib-1.11/carg_parser.c:50:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( p->argument, argument, len + 1 ); data/lzlib-1.11/carg_parser.c:58:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const int len = strlen( msg ); data/lzlib-1.11/carg_parser.c:62:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( ap->error + ap->error_size, msg, len + 1 ); data/lzlib-1.11/carg_parser.c:92:11: [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( options[i].name ) == len ) /* Exact match found */ data/lzlib-1.11/main.c:201:20: [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). stdin_name_len = strlen( pp->stdin_name ); data/lzlib-1.11/main.c:205:69: [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 unsigned len = (strcmp( s, "-" ) == 0) ? stdin_name_len : strlen( s ); data/lzlib-1.11/main.c:219: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). name_len = strlen( pp->name ); data/lzlib-1.11/main.c:267:60: [1] (obsolete) ulimit: This C routine is considered obsolete (as opposed to the shell command by the same name, which is NOT obsolete) (CWE-676). Use getrlimit(2), setrlimit(2), and sysconf(3) instead. const unsigned long long ulimit ) data/lzlib-1.11/main.c:303:11: [1] (obsolete) ulimit: This C routine is considered obsolete (as opposed to the shell command by the same name, which is NOT obsolete) (CWE-676). Use getrlimit(2), setrlimit(2), and sysconf(3) instead. if( ulimit / factor >= result ) result *= factor; data/lzlib-1.11/main.c:307:47: [1] (obsolete) ulimit: This C routine is considered obsolete (as opposed to the shell command by the same name, which is NOT obsolete) (CWE-676). Use getrlimit(2), setrlimit(2), and sysconf(3) instead. if( !errno && ( result < llimit || result > ulimit ) ) errno = ERANGE; data/lzlib-1.11/main.c:349:31: [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 unsigned name_len = strlen( name ); data/lzlib-1.11/main.c:350: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). const unsigned ext_len = strlen( ext ); data/lzlib-1.11/main.c:362:53: [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 = resize_buffer( output_filename, strlen( name ) + 5 + data/lzlib-1.11/main.c:363: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). strlen( known_extensions[0].from ) + 1 ); data/lzlib-1.11/main.c:373: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). const unsigned name_len = strlen( name ); data/lzlib-1.11/main.c:377:31: [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 unsigned from_len = strlen( from ); data/lzlib-1.11/main.c:381:40: [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( known_extensions[eindex].to ) + 1 ); data/lzlib-1.11/main.c:554:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const int n = read( fd, buf + sz, size - sz ); data/lzlib-1.11/main.c:584: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). const unsigned name_len = strlen( output_filename ); data/lzlib-1.11/main.c:585: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 unsigned ext_len = strlen( known_extensions[0].from ); data/lzlib-1.11/main.c:1080: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( default_output_filename ) + 1 ); ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 5779 in approximately 0.28 seconds (20621 lines/second) Physical Source Lines of Code (SLOC) = 4707 Hits@level = [0] 46 [1] 22 [2] 15 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 89 [1+] 43 [2+] 21 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 18.908 [1+] 9.13533 [2+] 4.46144 [3+] 1.2747 [4+] 1.2747 [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.