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/mbr-1.2.1/harness/args.c Examining data/mbr-1.2.1/harness/bios.c Examining data/mbr-1.2.1/harness/event.c Examining data/mbr-1.2.1/harness/harness.c Examining data/mbr-1.2.1/harness/harness.h Examining data/mbr-1.2.1/harness/mbr.c Examining data/mbr-1.2.1/harness/output.c Examining data/mbr-1.2.1/harness/process.c Examining data/mbr-1.2.1/harness/time.c Examining data/mbr-1.2.1/harness/vm86.c Examining data/mbr-1.2.1/harness/vm86.h Examining data/mbr-1.2.1/install-mbr.c Examining data/mbr-1.2.1/mbr.h FINAL RESULTS: data/mbr-1.2.1/harness/harness.h:56:64: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. extern void outputf(const char *format, ...) ATTRIBUTE((format(printf, 1, 2))); data/mbr-1.2.1/harness/output.c:88:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/mbr-1.2.1/install-mbr.c:1313:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(COPYRIGHT "\n"); data/mbr-1.2.1/harness/args.c:23:15: [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. int opt = getopt(argc, argv, "a:d:D:f:i:k:r:t:w:"); data/mbr-1.2.1/install-mbr.c:1189:7: [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. c=getopt_long(argc, argv, "fI:klno:y::P:rT:vVhd:e:i:p:t:", data/mbr-1.2.1/harness/mbr.c:8:17: [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 unsigned char mbr_data[512] = {0}; data/mbr-1.2.1/harness/mbr.c:33:7: [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). f = fopen(mbr_file, "rb"); data/mbr-1.2.1/harness/mbr.c:58: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(code, mbr_data, sizeof(mbr_data)); data/mbr-1.2.1/install-mbr.c:675: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(dest->data, src->data, CODE_SIZE); data/mbr-1.2.1/install-mbr.c:684: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(dest->data+PTN_TABLE_OFFSET, src->data+PTN_TABLE_OFFSET, data/mbr-1.2.1/install-mbr.c:742:10: [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(dsc->path, O_RDONLY|O_NOCTTY); data/mbr-1.2.1/install-mbr.c:799:10: [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). mbr_fd=open(dp->target.path, data/mbr-1.2.1/install-mbr.c:1228: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 *adjtime=fopen("/etc/adjtime", "r"); data/mbr-1.2.1/install-mbr.c:1241: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 buffer[1024]; data/mbr-1.2.1/install-mbr.c:722:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return do_io(read, dsc, fd, min_size); ANALYSIS SUMMARY: Hits = 15 Lines analyzed = 2907 in approximately 0.08 seconds (37140 lines/second) Physical Source Lines of Code (SLOC) = 2226 Hits@level = [0] 79 [1] 1 [2] 9 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 94 [1+] 15 [2+] 14 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 42.2282 [1+] 6.73854 [2+] 6.28931 [3+] 2.24618 [4+] 1.34771 [5+] 0 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.