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/iucode-tool-2.3.1/intel_microcode.h Examining data/iucode-tool-2.3.1/intel_microcode.c Examining data/iucode-tool-2.3.1/iucode_tool.c FINAL RESULTS: data/iucode-tool-2.3.1/iucode_tool.c:2802:3: [4] (format) snprintf: 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. snprintf(cpuid_device, sizeof(cpuid_device), data/iucode-tool-2.3.1/iucode_tool.c:190:14: [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 const char * const iuc_rev_match_mode_s[IUCODE_REVFLT_SIZE] = { data/iucode-tool-2.3.1/iucode_tool.c:319:8: [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). nfd = open("/dev/null", fl); data/iucode-tool-2.3.1/iucode_tool.c:1268: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 fnbuf[PATH_MAX]; data/iucode-tool-2.3.1/iucode_tool.c:1342:9: [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). fd = open(fn, O_RDONLY); data/iucode-tool-2.3.1/iucode_tool.c:1487:7: [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). fd = open(devname, O_WRONLY); data/iucode-tool-2.3.1/iucode_tool.c:1580: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[CPIO_MAX_HDRSIZE + 16]; /* worst case padding */ data/iucode-tool-2.3.1/iucode_tool.c:2542: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 fn[35]; /* "s%08X_m%08X_r%08X.fw" */ data/iucode-tool-2.3.1/iucode_tool.c:2554: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). dirfd = open(dirname, O_RDONLY); data/iucode-tool-2.3.1/iucode_tool.c:2616: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 fn[35]; /* "%02x-%02x-%02x" */ data/iucode-tool-2.3.1/iucode_tool.c:2627: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). dirfd = open(dirname, O_RDONLY); data/iucode-tool-2.3.1/iucode_tool.c:2767: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 cpuid_device[PATH_MAX]; data/iucode-tool-2.3.1/iucode_tool.c:3257:2: [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(n->path, fn, l); data/iucode-tool-2.3.1/iucode_tool.c:1087:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(fd, mcb_buffer + pos, data/iucode-tool-2.3.1/iucode_tool.c:1584:10: [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). nsize = strlen(name) + 1; data/iucode-tool-2.3.1/iucode_tool.c:1654:29: [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). s += CPIO_STATIC_HDRSIZE + strlen(LINUX_CPIO_UCODE_PADNAME) + 1; data/iucode-tool-2.3.1/iucode_tool.c:1655:9: [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). pad_fn[strlen(LINUX_CPIO_UCODE_PADNAME) - s % 16] = 0; data/iucode-tool-2.3.1/iucode_tool.c:1723:11: [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). strlen(LINUX_CPIO_UCODE_NAME), data/iucode-tool-2.3.1/iucode_tool.c:1781:26: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). int rc = write_data(fd, strncpy(buf, cpio_trailer, s), s); data/iucode-tool-2.3.1/iucode_tool.c:2833:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(cpuid_fd, &cpuid_buf, sizeof(cpuid_buf)) == -1) { data/iucode-tool-2.3.1/iucode_tool.c:3244:6: [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). l = strlen(fn); data/iucode-tool-2.3.1/iucode_tool.c:3348: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). strlen(iuc_rev_match_mode_s[i])))) data/iucode-tool-2.3.1/iucode_tool.c:3352:9: [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). p += strlen(iuc_rev_match_mode_s[i]); data/iucode-tool-2.3.1/iucode_tool.c:3490: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(arg) > 1) ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 4710 in approximately 0.13 seconds (36675 lines/second) Physical Source Lines of Code (SLOC) = 3155 Hits@level = [0] 13 [1] 11 [2] 12 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 37 [1+] 24 [2+] 13 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 11.7274 [1+] 7.60697 [2+] 4.12044 [3+] 0.316957 [4+] 0.316957 [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.