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/lziprecover-1.21/unzcrash.cc Examining data/lziprecover-1.21/split.cc Examining data/lziprecover-1.21/list.cc Examining data/lziprecover-1.21/lzip_index.h Examining data/lziprecover-1.21/mtester.cc Examining data/lziprecover-1.21/decoder.cc Examining data/lziprecover-1.21/range_dec.cc Examining data/lziprecover-1.21/main_common.cc Examining data/lziprecover-1.21/arg_parser.h Examining data/lziprecover-1.21/repair.cc Examining data/lziprecover-1.21/merge.cc Examining data/lziprecover-1.21/arg_parser.cc Examining data/lziprecover-1.21/mtester.h Examining data/lziprecover-1.21/lzip_index.cc Examining data/lziprecover-1.21/decoder.h Examining data/lziprecover-1.21/main.cc Examining data/lziprecover-1.21/lzip.h Examining data/lziprecover-1.21/dump_remove.cc Examining data/lziprecover-1.21/alone_to_lz.cc FINAL RESULTS: data/lziprecover-1.21/unzcrash.cc:379:16: [4] (shell) popen: 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. FILE * f = popen( command, "w" ); data/lziprecover-1.21/unzcrash.cc:392:11: [4] (shell) popen: 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. f = popen( zcmp_command, "w" ); data/lziprecover-1.21/unzcrash.cc:425:18: [4] (shell) popen: 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. FILE * f = popen( command, "w" ); data/lziprecover-1.21/unzcrash.cc:435:15: [4] (shell) popen: 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. f = popen( zcmp_command, "w" ); data/lziprecover-1.21/unzcrash.cc:457:18: [4] (shell) popen: 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. FILE * f = popen( command, "w" ); data/lziprecover-1.21/unzcrash.cc:469:15: [4] (shell) popen: 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. f = popen( zcmp_command, "w" ); data/lziprecover-1.21/unzcrash.cc:502:22: [4] (shell) popen: 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. FILE * f = popen( command, "w" ); data/lziprecover-1.21/unzcrash.cc:515:19: [4] (shell) popen: 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. f = popen( zcmp_command, "w" ); data/lziprecover-1.21/decoder.h:70:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy( outbuf + sz, buffer + pos, rd ); data/lziprecover-1.21/decoder.h:264: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. std::memcpy( buffer + lpos, buffer + i, len ); data/lziprecover-1.21/lzip.h:210:27: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. void set_magic() { std::memcpy( data, lzip_magic, 4 ); data[4] = 1; } data/lziprecover-1.21/lzip_index.cc:50: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 buf[80]; data/lziprecover-1.21/lzip_index.cc:139:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy( buffer + rd_size, buffer, buffer_size - rd_size ); data/lziprecover-1.21/main.cc:178:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[80]; data/lziprecover-1.21/main.cc:188:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[bufsize]; data/lziprecover-1.21/main.cc:189: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/lziprecover-1.21/main.cc:366:14: [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). int infd = open( name, O_RDONLY | O_BINARY ); data/lziprecover-1.21/main.cc:394: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). int fd = open( name, O_RDWR | O_BINARY ); data/lziprecover-1.21/main.cc:423: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.c_str(), flags, outfd_mode ); data/lziprecover-1.21/mtester.cc:40:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer[buffers][bufsize]; // circle of static buffers for printf data/lziprecover-1.21/mtester.cc:70:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy( tmp, buffer, std::min( data_position(), data/lziprecover-1.21/mtester.h:262: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. std::memcpy( buffer + lpos, buffer + i, len ); data/lziprecover-1.21/range_dec.cc:78: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 si_prefix[8] = data/lziprecover-1.21/range_dec.cc:80: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 binary_prefix[8] = data/lziprecover-1.21/range_dec.cc:83:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer[buffers][bufsize]; // circle of static buffers for printf data/lziprecover-1.21/unzcrash.cc:180: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 * const f = std::fopen( name, "rb" ); data/lziprecover-1.21/unzcrash.cc:296: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 * mode_str[3] = { "block", "byte", "size" }; data/lziprecover-1.21/unzcrash.cc:370: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 zcmp_command[1024] = { 0 }; data/lziprecover-1.21/unzcrash.cc:459:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy( block , buffer + i, size ); data/lziprecover-1.21/unzcrash.cc:480:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy( buffer + i, block, size ); data/lziprecover-1.21/arg_parser.cc:40:16: [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( std::strlen( options[i].name ) == len ) // Exact match found data/lziprecover-1.21/decoder.cc:46: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, std::min( 1L << 20, size - sz ) ); data/lziprecover-1.21/lzip.h:119: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). const unsigned stdin_name_len = std::strlen( stdin_name ); data/lziprecover-1.21/lzip.h:132: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). const unsigned stdin_name_len = std::strlen( stdin_name ); data/lziprecover-1.21/main_common.cc:89: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; ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 6160 in approximately 0.21 seconds (29468 lines/second) Physical Source Lines of Code (SLOC) = 5129 Hits@level = [0] 102 [1] 5 [2] 22 [3] 0 [4] 8 [5] 0 Hits@level+ = [0+] 137 [1+] 35 [2+] 30 [3+] 8 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 26.7109 [1+] 6.82394 [2+] 5.84909 [3+] 1.55976 [4+] 1.55976 [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.