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/r-bioc-rsamtools-2.6.0/src/BamFileIterator.h
Examining data/r-bioc-rsamtools-2.6.0/src/BamIterator.h
Examining data/r-bioc-rsamtools-2.6.0/src/BamRangeIterator.h
Examining data/r-bioc-rsamtools-2.6.0/src/Biostrings_stubs.c
Examining data/r-bioc-rsamtools-2.6.0/src/COMPAT_bcf_hdr_read.c
Examining data/r-bioc-rsamtools-2.6.0/src/COMPAT_bcf_hdr_read.h
Examining data/r-bioc-rsamtools-2.6.0/src/GenomicPosition.h
Examining data/r-bioc-rsamtools-2.6.0/src/IRanges_stubs.c
Examining data/r-bioc-rsamtools-2.6.0/src/PileupBuffer.cpp
Examining data/r-bioc-rsamtools-2.6.0/src/PileupBuffer.h
Examining data/r-bioc-rsamtools-2.6.0/src/PileupBufferShim.h
Examining data/r-bioc-rsamtools-2.6.0/src/PosCache.h
Examining data/r-bioc-rsamtools-2.6.0/src/PosCacheColl.cpp
Examining data/r-bioc-rsamtools-2.6.0/src/PosCacheColl.h
Examining data/r-bioc-rsamtools-2.6.0/src/R_init_Rsamtools.c
Examining data/r-bioc-rsamtools-2.6.0/src/ResultManager.cpp
Examining data/r-bioc-rsamtools-2.6.0/src/ResultManager.h
Examining data/r-bioc-rsamtools-2.6.0/src/S4Vectors_stubs.c
Examining data/r-bioc-rsamtools-2.6.0/src/Template.h
Examining data/r-bioc-rsamtools-2.6.0/src/XVector_stubs.c
Examining data/r-bioc-rsamtools-2.6.0/src/as_bam.c
Examining data/r-bioc-rsamtools-2.6.0/src/as_bam.h
Examining data/r-bioc-rsamtools-2.6.0/src/bam.c
Examining data/r-bioc-rsamtools-2.6.0/src/bam_data.c
Examining data/r-bioc-rsamtools-2.6.0/src/bam_data.h
Examining data/r-bioc-rsamtools-2.6.0/src/bam_mate_iter.cpp
Examining data/r-bioc-rsamtools-2.6.0/src/bam_mate_iter.h
Examining data/r-bioc-rsamtools-2.6.0/src/bam_plbuf.c
Examining data/r-bioc-rsamtools-2.6.0/src/bam_sort.c
Examining data/r-bioc-rsamtools-2.6.0/src/bambuffer.c
Examining data/r-bioc-rsamtools-2.6.0/src/bambuffer.h
Examining data/r-bioc-rsamtools-2.6.0/src/bamfile.c
Examining data/r-bioc-rsamtools-2.6.0/src/bamfile.h
Examining data/r-bioc-rsamtools-2.6.0/src/bcffile.c
Examining data/r-bioc-rsamtools-2.6.0/src/bcffile.h
Examining data/r-bioc-rsamtools-2.6.0/src/encode.c
Examining data/r-bioc-rsamtools-2.6.0/src/encode.h
Examining data/r-bioc-rsamtools-2.6.0/src/fafile.c
Examining data/r-bioc-rsamtools-2.6.0/src/fafile.h
Examining data/r-bioc-rsamtools-2.6.0/src/idxstats.c
Examining data/r-bioc-rsamtools-2.6.0/src/idxstats.h
Examining data/r-bioc-rsamtools-2.6.0/src/io_sam.c
Examining data/r-bioc-rsamtools-2.6.0/src/io_sam.h
Examining data/r-bioc-rsamtools-2.6.0/src/pbuffer_wrapper.cpp
Examining data/r-bioc-rsamtools-2.6.0/src/pbuffer_wrapper.h
Examining data/r-bioc-rsamtools-2.6.0/src/pileup.cpp
Examining data/r-bioc-rsamtools-2.6.0/src/pileup.h
Examining data/r-bioc-rsamtools-2.6.0/src/pileupbam.c
Examining data/r-bioc-rsamtools-2.6.0/src/pileupbam.h
Examining data/r-bioc-rsamtools-2.6.0/src/sam.c
Examining data/r-bioc-rsamtools-2.6.0/src/sam_opts.c
Examining data/r-bioc-rsamtools-2.6.0/src/sam_utils.c
Examining data/r-bioc-rsamtools-2.6.0/src/samtools_patch.c
Examining data/r-bioc-rsamtools-2.6.0/src/samtools_patch.h
Examining data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c
Examining data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.h
Examining data/r-bioc-rsamtools-2.6.0/src/tabixfile.c
Examining data/r-bioc-rsamtools-2.6.0/src/tabixfile.h
Examining data/r-bioc-rsamtools-2.6.0/src/tagfilter.c
Examining data/r-bioc-rsamtools-2.6.0/src/tagfilter.h
Examining data/r-bioc-rsamtools-2.6.0/src/utilities.c
Examining data/r-bioc-rsamtools-2.6.0/src/utilities.h
Examining data/r-bioc-rsamtools-2.6.0/src/zip_compression.c
Examining data/r-bioc-rsamtools-2.6.0/src/zip_compression.h

FINAL RESULTS:

data/r-bioc-rsamtools-2.6.0/src/bam_data.c:130:9:  [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(buf, s);
data/r-bioc-rsamtools-2.6.0/src/bam_data.c:365:13:  [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(buf, bam1_qname(bam));
data/r-bioc-rsamtools-2.6.0/src/bcffile.c:835:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(fidx, "%s.csi", fbcf);
data/r-bioc-rsamtools-2.6.0/src/io_sam.c:219:13:  [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(last_qname, bam1_qname(bam));
data/r-bioc-rsamtools-2.6.0/src/io_sam.c:776:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(fidx, "%s.bai", fbam);
data/r-bioc-rsamtools-2.6.0/src/samtools_patch.c:25:13:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        n = vfprintf(file, fmt, argp);
data/r-bioc-rsamtools-2.6.0/src/samtools_patch.c:34:13:  [4] (format) vsnprintf:
  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.
        n = vsnprintf(buf, bufsize, fmt, argp);
data/r-bioc-rsamtools-2.6.0/src/COMPAT_bcf_hdr_read.c:67:48:  [2] (integer) atol:
  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).
                kputs(",length=", &txt); kputl(atol(tab), &txt);
data/r-bioc-rsamtools-2.6.0/src/bam_data.c:164: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(&n, s, 4);
data/r-bioc-rsamtools-2.6.0/src/bam_data.c:209:12:  [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 buf_A[2];
data/r-bioc-rsamtools-2.6.0/src/bam_data.c:274:13:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
            sprintf(buf_A, "%c", bam_aux2A(aux));
data/r-bioc-rsamtools-2.6.0/src/bcffile.c:120:12:  [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 fnidx2[999];
data/r-bioc-rsamtools-2.6.0/src/fafile.c:155: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 classname[13];
data/r-bioc-rsamtools-2.6.0/src/fafile.c:167:23:  [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 *) CHAR(STRING_ELT(seq, i)), startp[i], endp[i]);
data/r-bioc-rsamtools-2.6.0/src/fafile.c:171:23:  [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 *) CHAR(STRING_ELT(seq, i)), startp[i], endp[i]);
data/r-bioc-rsamtools-2.6.0/src/fafile.c:176:23:  [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 *) CHAR(STRING_ELT(seq, i)), startp[i], endp[i]);
data/r-bioc-rsamtools-2.6.0/src/io_sam.c:33: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 buf[4];
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:164: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(INTEGER(s), sbd->flag, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:170: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(INTEGER(s), sbd->rname, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:178: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(INTEGER(s), sbd->strand, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:185: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(INTEGER(s), sbd->pos, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:191: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(INTEGER(s), sbd->qwidth, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:197: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(INTEGER(s), sbd->mapq, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:203: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(INTEGER(s), sbd->mrnm, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:211: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(INTEGER(s), sbd->mpos, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:217: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(INTEGER(s), sbd->isize, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:259: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(INTEGER(s), sbd->partition, Rf_length(s) * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/scan_bam_data.c:265: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(INTEGER(s), sbd->mates, sbd->icnt * sizeof(int));
data/r-bioc-rsamtools-2.6.0/src/tabixfile.c:287: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 comment[2];
data/r-bioc-rsamtools-2.6.0/src/tagfilter.c:115:9:  [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 val_as_string[51];
data/r-bioc-rsamtools-2.6.0/src/utilities.c:140: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 classname[40];         /* longest string should be "DNAStringSet" */
data/r-bioc-rsamtools-2.6.0/src/utilities.c:205:12:  [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 map[256];
data/r-bioc-rsamtools-2.6.0/src/zip_compression.c:28:13:  [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).
    *infd = open(translateChar(STRING_ELT(file, 0)), iflag);
data/r-bioc-rsamtools-2.6.0/src/zip_compression.c:33:14:  [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).
    *outfd = open(translateChar(STRING_ELT(dest, 0)), oflag, 0666);
data/r-bioc-rsamtools-2.6.0/src/Template.h:146: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).
        char *end = qname + strlen(qname);
data/r-bioc-rsamtools-2.6.0/src/bam_data.c:127:28:  [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).
        char *buf = Calloc(strlen(s) + 1, char);
data/r-bioc-rsamtools-2.6.0/src/bam_data.c:362:26:  [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).
            buf = Calloc(strlen(bam1_qname(bam)) + 1, char);
data/r-bioc-rsamtools-2.6.0/src/bcffile.c:834:35:  [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).
    char *fidx = (char *) R_alloc(strlen(fbcf) + 5, sizeof(char));
data/r-bioc-rsamtools-2.6.0/src/io_sam.c:775:35:  [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).
    char *fidx = (char *) R_alloc(strlen(fbam) + 5, sizeof(char));
data/r-bioc-rsamtools-2.6.0/src/tagfilter.c:149: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(*((const char**) list_elt)) != 1) {
data/r-bioc-rsamtools-2.6.0/src/utilities.c:160: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).
        INTEGER(width)[i] = strlen(key[i]);
data/r-bioc-rsamtools-2.6.0/src/utilities.c:170:57:  [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).
                                      dest.length, seq, strlen(seq), lkup0,
data/r-bioc-rsamtools-2.6.0/src/utilities.c:243:13:  [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).
    int i = strlen(s) - 1;
data/r-bioc-rsamtools-2.6.0/src/utilities.c:262:19:  [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).
        buf_len = strlen(buf);

ANALYSIS SUMMARY:

Hits = 44
Lines analyzed = 7854 in approximately 0.23 seconds (34610 lines/second)
Physical Source Lines of Code (SLOC) = 6488
Hits@level = [0]  13 [1]  10 [2]  27 [3]   0 [4]   7 [5]   0
Hits@level+ = [0+]  57 [1+]  44 [2+]  34 [3+]   7 [4+]   7 [5+]   0
Hits/KSLOC@level+ = [0+] 8.78545 [1+] 6.78175 [2+] 5.24044 [3+] 1.07891 [4+] 1.07891 [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.