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/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c Examining data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.h FINAL RESULTS: data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:551:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod(path, 0664 & ~current_umask); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:272:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(*cache_path, "%s/%02x/%014llx", cachedir, first_byte, remainder); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:96:33: [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 void bs_cache_path(const char * cachedir, const char * path, char (* cache_path)[MAX_CACHEPATH_SIZE]); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:96:56: [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 void bs_cache_path(const char * cachedir, const char * path, char (* cache_path)[MAX_CACHEPATH_SIZE]); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:96:69: [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 void bs_cache_path(const char * cachedir, const char * path, char (* cache_path)[MAX_CACHEPATH_SIZE]); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:265:21: [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. bs_cache_path(const char * cachedir, const char * path, char (* cache_path)[MAX_CACHEPATH_SIZE]) data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:265:44: [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. bs_cache_path(const char * cachedir, const char * path, char (* cache_path)[MAX_CACHEPATH_SIZE]) data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:265:57: [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. bs_cache_path(const char * cachedir, const char * path, char (* cache_path)[MAX_CACHEPATH_SIZE]) data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:315: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 cache_path[MAX_CACHEPATH_SIZE]; data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:333: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). fd = open(path, O_RDONLY); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:393: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). fd = open(path, O_RDONLY); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:500: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 template[MAX_CACHEPATH_SIZE + 20]; data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:506:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(tmp_path, ".tmp.XXXXXX"); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:509:8: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp(tmp_path); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:515: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). fd = open(tmp_path, O_WRONLY | O_CREAT, 0664); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:152:19: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). current_umask = umask(0777); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:153:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(current_umask); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:373:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t nread = read(fd, key, KEY_SIZE); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:444:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(fd, data, data_size); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:505:14: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). tmp_path = strncpy(template, path, MAX_CACHEPATH_SIZE); data/ruby-bootsnap-1.4.6/ext/bootsnap/bootsnap.c:566:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(fd, *contents, size); ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 835 in approximately 0.03 seconds (24583 lines/second) Physical Source Lines of Code (SLOC) = 508 Hits@level = [0] 0 [1] 6 [2] 13 [3] 0 [4] 1 [5] 1 Hits@level+ = [0+] 21 [1+] 21 [2+] 15 [3+] 2 [4+] 2 [5+] 1 Hits/KSLOC@level+ = [0+] 41.3386 [1+] 41.3386 [2+] 29.5276 [3+] 3.93701 [4+] 3.93701 [5+] 1.9685 Dot directories skipped = 2 (--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.