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-cool.io-1.7.0/ext/cool.io/cool.io.h Examining data/ruby-cool.io-1.7.0/ext/cool.io/cool.io_ext.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/ev_wrap.h Examining data/ruby-cool.io-1.7.0/ext/cool.io/iowatcher.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/libev.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/loop.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/stat_watcher.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/timer_watcher.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/utils.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/watcher.c Examining data/ruby-cool.io-1.7.0/ext/cool.io/watcher.h Examining data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev.h Examining data/ruby-cool.io-1.7.0/ext/libev/ev_epoll.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev_kqueue.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev_poll.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev_port.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev_select.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev_vars.h Examining data/ruby-cool.io-1.7.0/ext/libev/ev_win32.c Examining data/ruby-cool.io-1.7.0/ext/libev/ev_wrap.h Examining data/ruby-cool.io-1.7.0/ext/libev/test_libev_win32.c FINAL RESULTS: data/ruby-cool.io-1.7.0/ext/libev/ev.c:4390: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-cool.io-1.7.0/ext/libev/ev.c:2888: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-cool.io-1.7.0/ext/libev/ev.c:2889: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-cool.io-1.7.0/ext/cool.io/utils.c:55: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[512]; data/ruby-cool.io-1.7.0/ext/cool.io/utils.c:58:18: [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(!(cpuinfo = fopen("/proc/cpuinfo", "r"))) data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:43: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. unsigned char data[0]; data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:525:9: [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->head->data + buf->head->start, str, len); data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:534:13: [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(node->data, str, buf->node_size); data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:550:13: [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(node->data, str, len); data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:565:9: [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->tail->data + buf->tail->end, str, len); data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:580:9: [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->tail->data + buf->tail->end, str, nbytes); data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:605:9: [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(str, buf->head->data + buf->head->start, nbytes); data/ruby-cool.io-1.7.0/ext/iobuffer/iobuffer.c:681:9: [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(str, node->data + node->start, nbytes); data/ruby-cool.io-1.7.0/ext/libev/ev.c:474: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-cool.io-1.7.0/ext/libev/ev.c:1360: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-cool.io-1.7.0/ext/libev/ev.c:1400: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-cool.io-1.7.0/ext/libev/ev.c:1430: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-cool.io-1.7.0/ext/libev/ev.c:1470: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-cool.io-1.7.0/ext/libev/ev.c:2514: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-cool.io-1.7.0/ext/libev/ev.c:2889: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-cool.io-1.7.0/ext/libev/ev.c:4389: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-cool.io-1.7.0/ext/libev/ev.c:4471: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-cool.io-1.7.0/ext/libev/ev.c:5161: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-cool.io-1.7.0/ext/libev/ev_select.c:203: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-cool.io-1.7.0/ext/libev/ev_select.c:204: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-cool.io-1.7.0/ext/libev/ev_select.c:212: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-cool.io-1.7.0/ext/iobuffer/iobuffer.c:744:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes_read = read(fd, buf->tail->data + buf->tail->end, nbytes); data/ruby-cool.io-1.7.0/ext/libev/ev.c:1684: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-cool.io-1.7.0/ext/libev/ev.c:2509: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-cool.io-1.7.0/ext/libev/ev.c:2523: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-cool.io-1.7.0/ext/libev/ev.c:2625: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-cool.io-1.7.0/ext/libev/ev.c:4387: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-cool.io-1.7.0/ext/libev/ev.c:4473: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)); ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 10263 in approximately 0.25 seconds (40314 lines/second) Physical Source Lines of Code (SLOC) = 6998 Hits@level = [0] 11 [1] 7 [2] 23 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 44 [1+] 33 [2+] 26 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 6.28751 [1+] 4.71563 [2+] 3.71535 [3+] 0.428694 [4+] 0.142898 [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.