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-nio4r-2.3.1/ext/libev/test_libev_win32.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev_epoll.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev_port.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev.h Examining data/ruby-nio4r-2.3.1/ext/libev/ev_vars.h Examining data/ruby-nio4r-2.3.1/ext/libev/ev_wrap.h Examining data/ruby-nio4r-2.3.1/ext/libev/ev_kqueue.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev_poll.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev_win32.c Examining data/ruby-nio4r-2.3.1/ext/libev/ev_select.c Examining data/ruby-nio4r-2.3.1/ext/nio4r/monitor.c Examining data/ruby-nio4r-2.3.1/ext/nio4r/libev.h Examining data/ruby-nio4r-2.3.1/ext/nio4r/selector.c Examining data/ruby-nio4r-2.3.1/ext/nio4r/nio4r.h Examining data/ruby-nio4r-2.3.1/ext/nio4r/nio4r_ext.c Examining data/ruby-nio4r-2.3.1/ext/nio4r/bytebuffer.c FINAL RESULTS: data/ruby-nio4r-2.3.1/ext/libev/ev.c:4366:11: [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). strcpy (path, w->path); data/ruby-nio4r-2.3.1/ext/libev/ev.c:2885:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. && getenv ("LIBEV_FLAGS")) data/ruby-nio4r-2.3.1/ext/libev/ev.c:2886:23: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. flags = atoi (getenv ("LIBEV_FLAGS")); data/ruby-nio4r-2.3.1/ext/libev/ev.c:471: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 pad[128 - sizeof (uint32_t)]; data/ruby-nio4r-2.3.1/ext/libev/ev.c:1357:7: [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 (&r, &x, 4); data/ruby-nio4r-2.3.1/ext/libev/ev.c:1397:7: [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 (&r, &x, 4); data/ruby-nio4r-2.3.1/ext/libev/ev.c:1427:7: [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 (&r, &x, 8); data/ruby-nio4r-2.3.1/ext/libev/ev.c:1467:7: [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 (&r, &x, 8); data/ruby-nio4r-2.3.1/ext/libev/ev.c:2511: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. char dummy[4]; data/ruby-nio4r-2.3.1/ext/libev/ev.c:2886:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). flags = atoi (getenv ("LIBEV_FLAGS")); data/ruby-nio4r-2.3.1/ext/libev/ev.c:4365: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. char path [4096]; data/ruby-nio4r-2.3.1/ext/libev/ev.c:4447: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 buf [EV_INOTIFY_BUFSIZE]; data/ruby-nio4r-2.3.1/ext/libev/ev.c:5137:34: [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. cb (EV_A_ EV_STAT, ((char *)ANHE_w (timers [i])) - offsetof (struct ev_stat, timer)); data/ruby-nio4r-2.3.1/ext/libev/ev_select.c:155: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 (vec_ro, vec_ri, fd_setsize); data/ruby-nio4r-2.3.1/ext/libev/ev_select.c:156: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 (vec_wo, vec_wi, fd_setsize); data/ruby-nio4r-2.3.1/ext/libev/ev_select.c:164: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 (vec_eo, vec_wi, fd_setsize); data/ruby-nio4r-2.3.1/ext/nio4r/bytebuffer.c:275:5: [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(buffer->buffer + buffer->position, StringValuePtr(string), length); data/ruby-nio4r-2.3.1/ext/nio4r/selector.c:540: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 buffer[128]; data/ruby-nio4r-2.3.1/ext/libev/ev.c:1681:30: [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). write (STDERR_FILENO, msg, strlen (msg)); data/ruby-nio4r-2.3.1/ext/libev/ev.c:2506:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read (evpipe [1], &counter, sizeof (uint64_t)); data/ruby-nio4r-2.3.1/ext/libev/ev.c:2520:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read (evpipe [0], &dummy, sizeof (dummy)); data/ruby-nio4r-2.3.1/ext/libev/ev.c:2622:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t res = read (sigfd, si, sizeof (si)); data/ruby-nio4r-2.3.1/ext/libev/ev.c:4363:51: [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 ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) data/ruby-nio4r-2.3.1/ext/libev/ev.c:4449:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int len = read (fs_fd, buf, sizeof (buf)); data/ruby-nio4r-2.3.1/ext/nio4r/bytebuffer.c:296:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes_read = read(FPTR_TO_FD(fptr), buffer->buffer + buffer->position, nbytes); data/ruby-nio4r-2.3.1/ext/nio4r/selector.c:545:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(read(selector->wakeup_reader, buffer, 128) > 0); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 9308 in approximately 0.23 seconds (39954 lines/second) Physical Source Lines of Code (SLOC) = 6614 Hits@level = [0] 11 [1] 8 [2] 15 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 37 [1+] 26 [2+] 18 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 5.59419 [1+] 3.93106 [2+] 2.7215 [3+] 0.453583 [4+] 0.151194 [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.