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/snappy-1.1.8/snappy-c.cc Examining data/snappy-1.1.8/snappy-c.h Examining data/snappy-1.1.8/snappy-internal.h Examining data/snappy-1.1.8/snappy-sinksource.cc Examining data/snappy-1.1.8/snappy-sinksource.h Examining data/snappy-1.1.8/snappy-stubs-internal.cc Examining data/snappy-1.1.8/snappy-stubs-internal.h Examining data/snappy-1.1.8/snappy-test.cc Examining data/snappy-1.1.8/snappy-test.h Examining data/snappy-1.1.8/snappy.cc Examining data/snappy-1.1.8/snappy.h Examining data/snappy-1.1.8/snappy_compress_fuzzer.cc Examining data/snappy-1.1.8/snappy_uncompress_fuzzer.cc Examining data/snappy-1.1.8/snappy_unittest.cc FINAL RESULTS: data/snappy-1.1.8/snappy-test.cc:74:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buf, sizeof(buf), format, ap); data/snappy-1.1.8/snappy-test.cc:249: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, data/snappy-1.1.8/snappy-test.cc:53:24: [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. const char* srcdir = getenv("srcdir"); // This is set by Automake. data/snappy-1.1.8/snappy-sinksource.cc:77: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(dest_, data, n); data/snappy-1.1.8/snappy-sinksource.cc:91: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(dest_, data, n); data/snappy-1.1.8/snappy-stubs-internal.cc:37: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[Varint::kMax32]; data/snappy-1.1.8/snappy-stubs-internal.h:208: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(&t, p, sizeof t); data/snappy-1.1.8/snappy-stubs-internal.h:213: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(p, &v, sizeof v); data/snappy-1.1.8/snappy-stubs-internal.h:223: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(&t, p, sizeof t); data/snappy-1.1.8/snappy-stubs-internal.h:229: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(&t, p, sizeof t); data/snappy-1.1.8/snappy-stubs-internal.h:235: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(&t, p, sizeof t); data/snappy-1.1.8/snappy-stubs-internal.h:240: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(p, &v, sizeof v); data/snappy-1.1.8/snappy-stubs-internal.h:244: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(p, &v, sizeof v); data/snappy-1.1.8/snappy-stubs-internal.h:248: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(p, &v, sizeof v); data/snappy-1.1.8/snappy-test.cc:71: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[4096]; data/snappy-1.1.8/snappy-test.h:123: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). FILE* fp = fopen(filename.c_str(), "rb"); data/snappy-1.1.8/snappy-test.h:131:7: [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[4096]; data/snappy-1.1.8/snappy-test.h:147: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). FILE* fp = fopen(filename.c_str(), "wb"); data/snappy-1.1.8/snappy.cc:125: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 tmp[8]; data/snappy-1.1.8/snappy.cc:126: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(tmp, src, 8); data/snappy-1.1.8/snappy.cc:127: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(dst, tmp, 8); data/snappy-1.1.8/snappy.cc:134: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 tmp[16]; data/snappy-1.1.8/snappy.cc:135: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(tmp, src, 16); data/snappy-1.1.8/snappy.cc:136: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(dst, tmp, 16); data/snappy-1.1.8/snappy.cc:168: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. alignas(16) const char pshufb_fill_patterns[7][16] = { data/snappy-1.1.8/snappy.cc:373: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(op, literal, len); data/snappy-1.1.8/snappy.cc:748: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 scratch_[kMaximumTagLength]; // See RefillTag(). data/snappy-1.1.8/snappy.cc:946: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(scratch_ + nbuf, src, to_add); data/snappy-1.1.8/snappy.cc:1003: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 ulength[Varint::kMax32]; data/snappy-1.1.8/snappy.cc:1025: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(scratch, fragment, bytes_read); data/snappy-1.1.8/snappy.cc:1031: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(scratch + bytes_read, fragment, n); data/snappy-1.1.8/snappy.cc:1149: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(curr_iov_output_, ip, to_write); data/snappy-1.1.8/snappy.cc:1295: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(op, ip, len); data/snappy-1.1.8/snappy.cc:1484: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(op_ptr_, ip, len); data/snappy-1.1.8/snappy.cc:1529: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(op_ptr_, ip, avail); data/snappy-1.1.8/snappy.cc:1550: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(op_ptr_, ip, len); data/snappy-1.1.8/snappy_unittest.cc:87: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(dst, s.data(), size); data/snappy-1.1.8/snappy_unittest.cc:612: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 number[4]; data/snappy-1.1.8/snappy_unittest.cc:946: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 uncompressed[100]; ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 6021 in approximately 0.16 seconds (36500 lines/second) Physical Source Lines of Code (SLOC) = 3704 Hits@level = [0] 14 [1] 0 [2] 36 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 53 [1+] 39 [2+] 39 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 14.3089 [1+] 10.5292 [2+] 10.5292 [3+] 0.809935 [4+] 0.539957 [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.