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/xva-img-1.4.1/src/disk.cpp Examining data/xva-img-1.4.1/src/disk.hpp Examining data/xva-img-1.4.1/src/main.cpp Examining data/xva-img-1.4.1/src/package.cpp Examining data/xva-img-1.4.1/src/package.hpp Examining data/xva-img-1.4.1/src/progress.cpp Examining data/xva-img-1.4.1/src/progress.hpp Examining data/xva-img-1.4.1/src/readfile.cpp Examining data/xva-img-1.4.1/src/readfile.hpp Examining data/xva-img-1.4.1/src/sha1.cpp Examining data/xva-img-1.4.1/src/sha1.hpp Examining data/xva-img-1.4.1/src/writefile.cpp Examining data/xva-img-1.4.1/src/writefile.hpp FINAL RESULTS: data/xva-img-1.4.1/src/main.cpp:96:15: [3] (buffer) getopt_long: 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_long(argc, argv, "hvps", longopts, 0x0)) != -1) { data/xva-img-1.4.1/src/disk.cpp:82:13: [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(diskpath.c_str(), "w"); data/xva-img-1.4.1/src/disk.cpp:97:4: [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 path2[9]; data/xva-img-1.4.1/src/disk.cpp:143: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 bufnull[1048576] = { 0 }; data/xva-img-1.4.1/src/disk.cpp:181:13: [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(diskpath.c_str(), "r"); data/xva-img-1.4.1/src/disk.cpp:185: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 buf[1048576]; data/xva-img-1.4.1/src/disk.cpp:194: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 bufnull[1048576] = { 0 }; data/xva-img-1.4.1/src/disk.cpp:211: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 path2[9]; data/xva-img-1.4.1/src/package.cpp:101:13: [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(file.c_str(), "w"); data/xva-img-1.4.1/src/package.cpp:154: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 header[512] = { 0 }; data/xva-img-1.4.1/src/package.cpp:193:4: [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 null[512] = { 0 }; data/xva-img-1.4.1/src/package.cpp:203: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 null[1024] = { 0 }; data/xva-img-1.4.1/src/readfile.cpp:41:13: [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(path.c_str(), "r"); data/xva-img-1.4.1/src/readfile.cpp:46: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 buf[1024]; data/xva-img-1.4.1/src/sha1.cpp:43:11: [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 hash[SHA_DIGEST_LENGTH]; data/xva-img-1.4.1/src/sha1.cpp:47: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 hex[3]; data/xva-img-1.4.1/src/writefile.cpp:41:13: [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(path.c_str(), "w"); data/xva-img-1.4.1/src/disk.cpp:72:7: [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(de->d_name) == 8 && sscanf(de->d_name, "%u", &part)) data/xva-img-1.4.1/src/package.cpp:139:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(str, i->c_str(), len - 1); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 1263 in approximately 0.05 seconds (26796 lines/second) Physical Source Lines of Code (SLOC) = 690 Hits@level = [0] 23 [1] 2 [2] 16 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 42 [1+] 19 [2+] 17 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 60.8696 [1+] 27.5362 [2+] 24.6377 [3+] 1.44928 [4+] 0 [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.