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/lphdisk-0.9.1.ds1/lphdisk.c Examining data/lphdisk-0.9.1.ds1/vbe.h FINAL RESULTS: data/lphdisk-0.9.1.ds1/lphdisk.c:161:19: [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. if (debug_flag) vprintf(fmt, ap); data/lphdisk-0.9.1.ds1/lphdisk.c:695:3: [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(usage_string, progname, version_string); data/lphdisk-0.9.1.ds1/lphdisk.c:750:22: [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). if (optind < argc) strcpy(drive, argv[optind++]); data/lphdisk-0.9.1.ds1/lphdisk.c:714:9: [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, short_opts, long_opts, 0); data/lphdisk-0.9.1.ds1/lphdisk.c:266: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). if (!(f = fopen(pp_filename, "r"))) { data/lphdisk-0.9.1.ds1/lphdisk.c:371: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(buf, header_base, 16); /* Start off with the base header */ data/lphdisk-0.9.1.ds1/lphdisk.c:486: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). if (!(f = fopen(mtrr_filename, "r"))) { data/lphdisk-0.9.1.ds1/lphdisk.c:511: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 s[128]; data/lphdisk-0.9.1.ds1/lphdisk.c:513: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). if (!(f = fopen(meminfo_filename, "r"))) { data/lphdisk-0.9.1.ds1/lphdisk.c:612: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(info->vbe_signature, "VBE2", 4); data/lphdisk-0.9.1.ds1/lphdisk.c:699: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 drive[FILENAME_MAX] = "/dev/hda";/* Default to /dev/hda */ data/lphdisk-0.9.1.ds1/lphdisk.c:702:12: [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 mbr_buf[MBR_SIZE]; data/lphdisk-0.9.1.ds1/lphdisk.c:791:13: [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 ((fd = open(drive, O_RDWR)) == -1) { data/lphdisk-0.9.1.ds1/vbe.h:11: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 vbe_signature[4]; data/lphdisk-0.9.1.ds1/vbe.h:26: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 reserved[222]; data/lphdisk-0.9.1.ds1/vbe.h:27: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 oem_data[256]; data/lphdisk-0.9.1.ds1/vbe.h:85: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 res2[206]; data/lphdisk-0.9.1.ds1/lphdisk.c:187:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (read(fd, buf, MBR_SIZE) != MBR_SIZE)) { ANALYSIS SUMMARY: Hits = 18 Lines analyzed = 993 in approximately 0.04 seconds (24857 lines/second) Physical Source Lines of Code (SLOC) = 643 Hits@level = [0] 34 [1] 1 [2] 13 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 52 [1+] 18 [2+] 17 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 80.8709 [1+] 27.9938 [2+] 26.4386 [3+] 6.22084 [4+] 4.66563 [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.