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-mmap2-2.2.7/ext/mmap/mmap.c

FINAL RESULTS:

data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:850:3:  [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(i_mm->t->template, template);
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:109:8:  [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 char template[1024];
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:394:15:  [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(i_mm->t->path, i_mm->t->smode)) == -1) {
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:754:16:  [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(path, smode, perm)) == -1) {
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:810:3:  [2] (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). Risk is low because the source is a constant string.
		strcpy(template, "/tmp/ruby_mmap.XXXXXX");
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:811:7:  [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).
		if (mkstemp(template) == -1) {
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:842:6:  [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(data, i_mm->t, sizeof(mm_mmap));
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:1235: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(RSTRING_PTR(str) + start + RMATCH(match)->BEG(0),
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:1339: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(RSTRING_PTR(str) + start + RMATCH(match)->BEG(0),
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:1624:6:  [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(sptr + i_mm->t->real, ptr, len);
data/ruby-mmap2-2.2.7/ext/mmap/mmap.c:849:37:  [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).
		i_mm->t->template = ALLOC_N(char, strlen(template) + 1);

ANALYSIS SUMMARY:

Hits = 11
Lines analyzed = 2607 in approximately 0.06 seconds (40668 lines/second)
Physical Source Lines of Code (SLOC) = 2001
Hits@level = [0]   0 [1]   1 [2]   9 [3]   0 [4]   1 [5]   0
Hits@level+ = [0+]  11 [1+]  11 [2+]  10 [3+]   1 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 5.49725 [1+] 5.49725 [2+] 4.9975 [3+] 0.49975 [4+] 0.49975 [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.