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/pixz-1.0.7/src/common.c Examining data/pixz-1.0.7/src/cpu.c Examining data/pixz-1.0.7/src/endian.c Examining data/pixz-1.0.7/src/list.c Examining data/pixz-1.0.7/src/pixz.c Examining data/pixz-1.0.7/src/pixz.h Examining data/pixz-1.0.7/src/read.c Examining data/pixz-1.0.7/src/write.c FINAL RESULTS: data/pixz-1.0.7/src/common.c:17:5: [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, fmt, args); data/pixz-1.0.7/src/pixz.c:206:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(r + li - l1, suf2); data/pixz-1.0.7/src/pixz.h:31:29: [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. #define debug(str, ...) fprintf(stderr, str "\n", ##__VA_ARGS__) data/pixz-1.0.7/src/pixz.c:69:18: [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 ((ch = getopt(argc, argv, "dcxli:o:tkvhp:0123456789f:q:e")) != -1) { data/pixz-1.0.7/src/common.c:31: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. return memcpy(r, s, len + 1); data/pixz-1.0.7/src/endian.c:49: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(d, &tmp, sizeof(tmp)); data/pixz-1.0.7/src/pixz.c:132: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). if (ipath && !(gInFile = fopen(ipath, "r"))) data/pixz-1.0.7/src/pixz.c:139:26: [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 (!(gOutFile = fopen(opath, "w"))) data/pixz-1.0.7/src/pixz.c:150:26: [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). if ((output_fd = open(opath, O_CREAT | O_WRONLY, input_stat.st_mode)) == -1) data/pixz-1.0.7/src/pixz.c:205: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(r, in, li - l1); data/pixz-1.0.7/src/read.c:472:2: [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 zeros[4] = "\0\0\0\0"; data/pixz-1.0.7/src/write.c:318: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(output, input, size); data/pixz-1.0.7/src/write.c:504: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(gFileIndexBuf + gFileIndexBufPos, buf + bufpos, len); data/pixz-1.0.7/src/common.c:27:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(s); data/pixz-1.0.7/src/common.c:35: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). size_t i = strlen(name); data/pixz-1.0.7/src/common.c:98:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int b = fgetc(gInFile); data/pixz-1.0.7/src/common.c:168: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). f->name = strlen(name) ? xstrdup(name) : NULL; data/pixz-1.0.7/src/pixz.c:195: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). size_t bl = strlen(big), sl = strlen(small); data/pixz-1.0.7/src/pixz.c:195: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). size_t bl = strlen(big), sl = strlen(small); data/pixz-1.0.7/src/pixz.c:203: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). size_t li = strlen(in), l1 = strlen(suf1), l2 = strlen(suf2); data/pixz-1.0.7/src/pixz.c:203:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t li = strlen(in), l1 = strlen(suf1), l2 = strlen(suf2); data/pixz-1.0.7/src/pixz.c:203: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). size_t li = strlen(in), l1 = strlen(suf1), l2 = strlen(suf2); data/pixz-1.0.7/src/write.c:484: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). size_t len = strlen(name); ANALYSIS SUMMARY: Hits = 23 Lines analyzed = 2255 in approximately 0.33 seconds (6804 lines/second) Physical Source Lines of Code (SLOC) = 1801 Hits@level = [0] 18 [1] 10 [2] 9 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 41 [1+] 23 [2+] 13 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 22.7651 [1+] 12.7707 [2+] 7.21821 [3+] 2.22099 [4+] 1.66574 [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.