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/samtools-1.11/amplicon_stats.c
Examining data/samtools-1.11/bam.c
Examining data/samtools-1.11/bam.h
Examining data/samtools-1.11/bam2bcf.c
Examining data/samtools-1.11/bam2bcf.h
Examining data/samtools-1.11/bam2bcf_indel.c
Examining data/samtools-1.11/bam2depth.c
Examining data/samtools-1.11/bam_addrprg.c
Examining data/samtools-1.11/bam_ampliconclip.c
Examining data/samtools-1.11/bam_ampliconclip.h
Examining data/samtools-1.11/bam_aux.c
Examining data/samtools-1.11/bam_cat.c
Examining data/samtools-1.11/bam_color.c
Examining data/samtools-1.11/bam_endian.h
Examining data/samtools-1.11/bam_fastq.c
Examining data/samtools-1.11/bam_flags.c
Examining data/samtools-1.11/bam_index.c
Examining data/samtools-1.11/bam_lpileup.c
Examining data/samtools-1.11/bam_lpileup.h
Examining data/samtools-1.11/bam_markdup.c
Examining data/samtools-1.11/bam_mate.c
Examining data/samtools-1.11/bam_md.c
Examining data/samtools-1.11/bam_plbuf.c
Examining data/samtools-1.11/bam_plbuf.h
Examining data/samtools-1.11/bam_plcmd.c
Examining data/samtools-1.11/bam_quickcheck.c
Examining data/samtools-1.11/bam_reheader.c
Examining data/samtools-1.11/bam_rmdup.c
Examining data/samtools-1.11/bam_rmdupse.c
Examining data/samtools-1.11/bam_sort.c
Examining data/samtools-1.11/bam_split.c
Examining data/samtools-1.11/bam_stat.c
Examining data/samtools-1.11/bam_tview.c
Examining data/samtools-1.11/bam_tview.h
Examining data/samtools-1.11/bam_tview_curses.c
Examining data/samtools-1.11/bam_tview_html.c
Examining data/samtools-1.11/bamshuf.c
Examining data/samtools-1.11/bamtk.c
Examining data/samtools-1.11/bedcov.c
Examining data/samtools-1.11/bedidx.c
Examining data/samtools-1.11/bedidx.h
Examining data/samtools-1.11/coverage.c
Examining data/samtools-1.11/cut_target.c
Examining data/samtools-1.11/dict.c
Examining data/samtools-1.11/faidx.c
Examining data/samtools-1.11/lz4/lz4.c
Examining data/samtools-1.11/lz4/lz4.h
Examining data/samtools-1.11/misc/ace2sam.c
Examining data/samtools-1.11/misc/maq2sam.c
Examining data/samtools-1.11/misc/md5fa.c
Examining data/samtools-1.11/misc/md5sum-lite.c
Examining data/samtools-1.11/misc/wgsim.c
Examining data/samtools-1.11/padding.c
Examining data/samtools-1.11/phase.c
Examining data/samtools-1.11/sam.c
Examining data/samtools-1.11/sam.h
Examining data/samtools-1.11/sam_opts.c
Examining data/samtools-1.11/sam_opts.h
Examining data/samtools-1.11/sam_utils.c
Examining data/samtools-1.11/sam_view.c
Examining data/samtools-1.11/sample.c
Examining data/samtools-1.11/sample.h
Examining data/samtools-1.11/samtools.h
Examining data/samtools-1.11/stats.c
Examining data/samtools-1.11/stats_isize.c
Examining data/samtools-1.11/stats_isize.h
Examining data/samtools-1.11/test/merge/test_bam_translate.c
Examining data/samtools-1.11/test/merge/test_rtrans_build.c
Examining data/samtools-1.11/test/merge/test_trans_tbl_init.c
Examining data/samtools-1.11/test/split/test_count_rg.c
Examining data/samtools-1.11/test/split/test_expand_format_string.c
Examining data/samtools-1.11/test/split/test_filter_header_rg.c
Examining data/samtools-1.11/test/split/test_parse_args.c
Examining data/samtools-1.11/test/test.c
Examining data/samtools-1.11/test/test.h
Examining data/samtools-1.11/test/tview/test_get_rg_sample.c
Examining data/samtools-1.11/test/vcf-miniview.c
Examining data/samtools-1.11/tmp_file.c
Examining data/samtools-1.11/tmp_file.h

FINAL RESULTS:

data/samtools-1.11/amplicon_stats.c:242:13:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            fprintf(ofp, "%c%"PRId64"-%"PRId64, "\t,"[amp[j].nleft > 1],
data/samtools-1.11/amplicon_stats.c:267:13:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            fprintf(ofp, "%c%"PRId64"-%"PRId64, "\t,"[amp[j].nright > 1],
data/samtools-1.11/amplicon_stats.c:839:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(ofp, "\t%"PRId64, stats->nreads[i]);
data/samtools-1.11/bam2depth.c:311:25:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                        fprintf(file_out, "\t%"PRIhts_pos, last_pos+1);
data/samtools-1.11/bam2depth.c:329:17:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                fprintf(file_out, "\t%"PRIhts_pos, last_pos+1);
data/samtools-1.11/bam2depth.c:340:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(file_out, "\t%"PRIhts_pos, pos+1); // a customized printf() would be faster
data/samtools-1.11/bam2depth.c:372:17:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                fprintf(file_out, "\t%"PRIhts_pos, last_pos+1);
data/samtools-1.11/bam_ampliconclip.c:123:17:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
            if (sscanf(line.s, "%*s %"SCNd64" %"SCNd64, &left, &right) != 2) {
data/samtools-1.11/bam_fastq.c:438:21:  [4] (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).
                    strcat(state->index_sequence, INDEX_SEPARATOR);
data/samtools-1.11/bam_fastq.c:439:21:  [4] (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).
                    strcat(state->index_sequence, sub_tag);
data/samtools-1.11/bam_index.c:232:13:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            printf("%s\t%"PRId64, sam_hdr_tid2name(header, i), (int64_t) sam_hdr_tid2len(header, i));
data/samtools-1.11/bam_plcmd.c:842:37:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                                    fprintf(pileup_fp, "%"PRId64, (int64_t) p->b->core.pos + 1);
data/samtools-1.11/bam_plcmd.c:854:37:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                                    fprintf(pileup_fp, "%"PRId64, (int64_t) p->b->core.mpos + 1);
data/samtools-1.11/bam_plcmd.c:1302:40:  [4] (buffer) fscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
                while (!feof(fp_rg) && fscanf(fp_rg, "%s", buf) > 0) // this is not a good style, but forgive me...
data/samtools-1.11/bam_quickcheck.c:77:35:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    if (!quiet || verbose >= (v)) fprintf(stderr, (msg), (arg1))
data/samtools-1.11/bam_reheader.c:484:16:  [4] (shell) popen:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    FILE* nh = popen(command, "r");
data/samtools-1.11/bam_sort.c:2276:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(name, "%s.%.4d.bam", w->prefix, w->index);
data/samtools-1.11/bam_sort.c:2547:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(fns[i], "%s.%.4d.bam", prefix, i);
data/samtools-1.11/bam_sort.c:2587:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(fnout, "%s.bam", prefix);
data/samtools-1.11/bam_tview.c:369:9:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
        sprintf(str, "%s:%"PRIhts_pos"-%"PRIhts_pos, ref_name, tv->left_pos + 1, tv->left_pos + tv->mcol);
data/samtools-1.11/bam_tview.c:418:9:  [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.
        vfprintf(stderr, format, ap);
data/samtools-1.11/bam_tview_curses.c:86:5:  [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.
    vsnprintf(str,size, fmt, argptr);
data/samtools-1.11/bam_tview_html.c:73:12:  [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.
    nchars=vsnprintf(str,size, fmt, argptr);
data/samtools-1.11/bamshuf.c:233:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(fnw, "%s.bam", pre); // "wb" above makes BAM the default
data/samtools-1.11/bamshuf.c:235:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(fnw, "%s.%s", pre,  hts_format_file_extension(&ga->out));
data/samtools-1.11/bamshuf.c:278:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(fnt[i], "%s.%04d.bam", pre, counter++);
data/samtools-1.11/bedcov.c:197:15:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
        num = sscanf(p + 1, "%"SCNd64" %"SCNd64, &beg, &end);
data/samtools-1.11/bedidx.c:284:19:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
            num = sscanf(ref_end + 1, "%"SCNu64" %"SCNu64, &beg, &end);
data/samtools-1.11/bedidx.c:531: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(reg, regs[i]);
data/samtools-1.11/coverage.c:154:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(buf, " %*s%*s", len+padding, text, padding-1+padding_ex, " ");
data/samtools-1.11/coverage.c:156:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(buf, "%s", text);
data/samtools-1.11/coverage.c:168:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(buf, "%.*f%s", i, base_pairs, units[i]);
data/samtools-1.11/coverage.c:238:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(file_out, VERTICAL_LINE);
data/samtools-1.11/coverage.c:251:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(file_out, VERTICAL_LINE);
data/samtools-1.11/lz4/lz4.c:298:21:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                    fprintf(stderr, __FILE__ ": ");   \
data/samtools-1.11/lz4/lz4.c:299:21:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                    fprintf(stderr, __VA_ARGS__);     \
data/samtools-1.11/padding.c:492:9:  [4] (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).
        strcat(out_mode, tmp);
data/samtools-1.11/padding.c:527:5:  [4] (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).
    strcat(out_mode, sam_open_mode(wmode, fn_out, NULL)==0 ? wmode : "b");
data/samtools-1.11/sam.c:134:12:  [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).
    strcat(strcpy(fn_list, fn_ref), ".fai");
data/samtools-1.11/sam.c:135:9:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    if (access(fn_list, R_OK) == -1) { // fn_list is unreadable
data/samtools-1.11/sam.c:136:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
        if (access(fn_ref, R_OK) == -1) {
data/samtools-1.11/sam_opts.c:77:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(ref, "reference=%s", optarg);
data/samtools-1.11/sam_utils.c:40:5:  [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.
    vfprintf(stderr, format, args);
data/samtools-1.11/sam_utils.c:128:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(fn_idx, "%s.%s", fn, suffix);
data/samtools-1.11/sam_view.c:482:9:  [4] (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).
        strcat(out_mode, tmp);
data/samtools-1.11/sam_view.c:483:9:  [4] (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).
        strcat(out_un_mode, tmp);
data/samtools-1.11/stats.c:1871:15:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
        if ( (sscanf(&line.s[i+1],"%"SCNd64" %"SCNd64, &stats->regions[tid].pos[npos].beg, &stats->regions[tid].pos[npos].end))!=2 ) error("Could not parse the region [%s]\n", &line.s[i+1]);
data/samtools-1.11/stats.c:2084:9:  [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.
        vfprintf(stderr, format, ap);
data/samtools-1.11/test/test.c:44:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(stderr, __FILE__": error reopening %s: %s\n",
data/samtools-1.11/tmp_file.c:51:9:  [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.
        vfprintf(stderr, fmt, argp);
data/samtools-1.11/tmp_file.c:108:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(tmp->name, "%s.%d", tmp_name, count);
data/samtools-1.11/amplicon_stats.c:1372:18:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ( (opt=getopt_long(argc,argv,"?hf:F:@:p:m:d:sa:l:t:o:c:b:D:",loptions,NULL))>0 ) {
data/samtools-1.11/bam2depth.c:136:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((n = getopt_long(argc, argv, "r:b:Xq:Q:l:f:am:d:Ho:g:G:Js", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_addrprg.c:203:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((n = getopt_long(argc, argv, "r:R:m:o:O:h@:u", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_ampliconclip.c:896:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "b:@:o:O:f:u", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_cat.c:484:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "h:o:b:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_fastq.c:548:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "0:1:2:o:f:F:G:niNOs:c:tT:v:@:", lopts, NULL)) > 0) {
data/samtools-1.11/bam_index.c:62:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt(argc, argv, "bcm:@:")) >= 0)
data/samtools-1.11/bam_index.c:187:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "@:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_markdup.c:1783:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "rsl:StT:O:@:f:d:ncm:u", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_mate.c:441:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "rpcmO:@:u", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_md.c:258:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "EqQreuNhbSC:n:Ad@:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_plcmd.c:1219:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "Agf:r:l:q:Q:uRC:BDSd:L:b:P:po:e:h:Im:F:EG:6OsVvxXt:a",lopts,NULL)) >= 0) {
data/samtools-1.11/bam_quickcheck.c:86:19:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((opt = getopt(argc, argv, optstring)) != -1) {
data/samtools-1.11/bam_reheader.c:549:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "hiPc:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_rmdup.c:281:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "sS", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_sort.c:309:43:  [3] (random) lrand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
        ksprintf(dest, "%s-%0lX", prefix, lrand48());
data/samtools-1.11/bam_sort.c:1443:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "h:nru1R:f@:l:cps:b:O:t:XL:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_sort.c:2646:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "l:m:no:O:T:@:t:MK:u", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_split.c:121:19:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((opt = getopt_long(argc, argv, optstring, lopts, NULL)) != -1) {
data/samtools-1.11/bam_stat.c:257:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "@:O:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_tview.c:446:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "s:p:d:Xw:", lopts, NULL)) >= 0) {
data/samtools-1.11/bam_tview_html.c:321:18:  [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.
    char* colstr=getenv("COLUMNS");
data/samtools-1.11/bamshuf.c:593:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "n:l:uOo:@:fr:", lopts, NULL)) >= 0) {
data/samtools-1.11/bedcov.c:88:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "Q:Xg:G:jd:", lopts, NULL)) >= 0) {
data/samtools-1.11/coverage.c:345:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "Ao:L:q:Q:hHw:r:b:m", lopts, NULL)) != -1) {
data/samtools-1.11/coverage.c:403:35:  [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.
        const char* env_columns = getenv("COLUMNS");
data/samtools-1.11/cut_target.c:188:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "f:Q:i:o:0:1:2:", lopts, NULL)) >= 0) {
data/samtools-1.11/dict.c:103:31:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
            char *real_path = realpath(fn, NULL);
data/samtools-1.11/dict.c:153:16:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ( (c=getopt_long(argc,argv,"?AhHa:s:u:o:",loptions,NULL))>0 )
data/samtools-1.11/faidx.c:266:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "ho:n:cr:fi", lopts, NULL)) >= 0) {
data/samtools-1.11/misc/ace2sam.c:76:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt(argc, argv, "pc")) >= 0) {
data/samtools-1.11/misc/wgsim.c:76:24:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            v1 = 2.0 * drand48() - 1.0;
data/samtools-1.11/misc/wgsim.c:77:24:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            v2 = 2.0 * drand48() - 1.0;
data/samtools-1.11/misc/wgsim.c:121:17:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (drand48() < INDEL_EXTEND) {
data/samtools-1.11/misc/wgsim.c:127:22:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
        if (c < 4 && drand48() < MUT_RATE) { // mutation
data/samtools-1.11/misc/wgsim.c:128:17:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (drand48() >= INDEL_FRAC) { // substitution
data/samtools-1.11/misc/wgsim.c:129:28:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                double r = drand48();
data/samtools-1.11/misc/wgsim.c:131:31:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                if (is_hap || drand48() < 0.333333) { // hom
data/samtools-1.11/misc/wgsim.c:134:25:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                    ret[drand48()<0.5?0:1]->s[i] = SUBSTITUTE|c;
data/samtools-1.11/misc/wgsim.c:137:21:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                if (drand48() < 0.5) { // deletion
data/samtools-1.11/misc/wgsim.c:138:35:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                    if (is_hap || drand48() < 0.333333) { // hom-del
data/samtools-1.11/misc/wgsim.c:142:36:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                        deleting = drand48()<0.5?1:2;
data/samtools-1.11/misc/wgsim.c:149:50:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                        ins = (ins << 2) | (int)(drand48() * 4.0);
data/samtools-1.11/misc/wgsim.c:150:45:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                    } while (num_ins < 4 && drand48() < INDEL_EXTEND);
data/samtools-1.11/misc/wgsim.c:152:35:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                    if (is_hap || drand48() < 0.333333) { // hom-ins
data/samtools-1.11/misc/wgsim.c:155:29:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                        ret[drand48()<0.5?0:1]->s[i] = (num_ins << 12) | (ins << 4) | c;
data/samtools-1.11/misc/wgsim.c:298:43:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                pos = (int)((l - d + 1) * drand48());
data/samtools-1.11/misc/wgsim.c:302:17:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (drand48() < 0.5) {
data/samtools-1.11/misc/wgsim.c:312:27:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            target = rseq[drand48()<0.5?0:1].s; // haplotype from which the reads are generated
data/samtools-1.11/misc/wgsim.c:373:32:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                    } else if (drand48() < ERR_RATE) {
data/samtools-1.11/misc/wgsim.c:444:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt(argc, argv, "e:d:s:N:1:2:r:R:hX:S:A:")) >= 0) {
data/samtools-1.11/padding.c:463:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "SCso:u1T:?", lopts, NULL)) >= 0) {
data/samtools-1.11/phase.c:346:16:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    is_flip = (drand48() < 0.5);
data/samtools-1.11/phase.c:369:34:  [3] (random) drand48:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
        if (which == 3) which = (drand48() < 0.5);
data/samtools-1.11/phase.c:608:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv, "Q:eFq:k:b:l:D:A", lopts, NULL)) >= 0) {
data/samtools-1.11/sam_view.c:311:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((c = getopt_long(argc, argv,
data/samtools-1.11/sam_view.c:319:17:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                srand(settings.subsam_seed);
data/samtools-1.11/stats.c:2399:18:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ( (opt=getopt_long(argc,argv,"?hdsXxpr:c:l:i:t:m:q:f:F:g:I:S:P:@:",loptions,NULL))>0 )
data/samtools-1.11/test/merge/test_bam_translate.c:347:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/test/merge/test_rtrans_build.c:72:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/test/merge/test_trans_tbl_init.c:315:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/test/split/test_count_rg.c:51:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/test/split/test_expand_format_string.c:51:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/test/split/test_filter_header_rg.c:161:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/test/split/test_parse_args.c:77:27:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((getopt_char = getopt(argc, argv, "v")) != -1) {
data/samtools-1.11/amplicon_stats.c:1147: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 sname_[8192], *sname = NULL;
data/samtools-1.11/amplicon_stats.c:1237: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(sname, nstart, nend-nstart);
data/samtools-1.11/amplicon_stats.c:1380:36:  [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).
        case 'm': args.max_delta = atoi(optarg); break; // margin
data/samtools-1.11/amplicon_stats.c:1395:34:  [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).
        case 'a': args.max_amp = atoi(optarg)+1;break;
data/samtools-1.11/amplicon_stats.c:1396:38:  [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).
        case 'l': args.max_amp_len = atoi(optarg)+1;break;
data/samtools-1.11/amplicon_stats.c:1398:43:  [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).
        case 'c': args.tcoord_min_count = atoi(optarg);break;
data/samtools-1.11/amplicon_stats.c:1400:31:  [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).
            args.tcoord_bin = atoi(optarg);
data/samtools-1.11/amplicon_stats.c:1405:35:  [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).
        case 't': args.tlen_adj = atoi(optarg);break;
data/samtools-1.11/amplicon_stats.c:1410:33:  [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 (!(args.out_fp = fopen(optarg, "w"))) {
data/samtools-1.11/bam.c:91: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 LB_text[1024];
data/samtools-1.11/bam.c:94: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(LB_text, lib.s, len);
data/samtools-1.11/bam.c:201: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(cigar, new_cigar, l * 4); // set CIGAR
data/samtools-1.11/bam.h:513:62:  [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 inline uint8_t *bam_aux_get_core(bam1_t *b, const char tag[2]) { return bam_aux_get(b, tag); } // an alias of bam_aux_get()
data/samtools-1.11/bam2bcf_indel.c:519: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(&bca->inscns[t * bca->maxins], &inscns[(sumq[t]&0x3f) * max_ins], bca->maxins);
data/samtools-1.11/bam2depth.c:138:33:  [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).
            case 'l': min_len = atoi(optarg); break; // minimum query length
data/samtools-1.11/bam2depth.c:148:31:  [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).
            case 'q': baseQ = atoi(optarg); break;   // base quality threshold
data/samtools-1.11/bam2depth.c:149:30:  [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).
            case 'Q': mapQ = atoi(optarg); break;    // mapping quality threshold
data/samtools-1.11/bam2depth.c:152:45:  [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).
            case 'd': case 'm': max_depth = atoi(optarg); break; // maximum coverage depth
data/samtools-1.11/bam2depth.c:186:20:  [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).
        file_out = fopen( output_file, "w" );
data/samtools-1.11/bam_addrprg.c:147: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(ns, s, len);
data/samtools-1.11/bam_addrprg.c:322: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 output_mode[9] = "w";
data/samtools-1.11/bam_ampliconclip.c:251: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(&rec_out->core, &rec->core, sizeof(rec->core));
data/samtools-1.11/bam_ampliconclip.c:252: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(rec_out->data, rec->data, rec->core.l_qname);
data/samtools-1.11/bam_ampliconclip.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(bam_get_aux(rec_out), orig_aux, orig_l_aux);
data/samtools-1.11/bam_ampliconclip.c:339: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(bam_get_seq(rec_out), orig_seq + (qry_removed / 2),
data/samtools-1.11/bam_ampliconclip.c:363: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(bam_get_aux(rec_out), orig_aux, orig_l_aux);
data/samtools-1.11/bam_ampliconclip.c:401: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(&rec_out->core, &rec->core, sizeof(rec->core));
data/samtools-1.11/bam_ampliconclip.c:402: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(rec_out->data, rec->data, rec->core.l_qname);
data/samtools-1.11/bam_ampliconclip.c:409: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(bam_get_aux(rec_out), orig_aux, orig_l_aux);
data/samtools-1.11/bam_ampliconclip.c:486: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(bam_get_seq(rec_out), orig_seq, (rec->core.l_qseq - qry_removed + 1) / 2);
data/samtools-1.11/bam_ampliconclip.c:489: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(new_qual, orig_qual, rec->core.l_qseq - qry_removed);
data/samtools-1.11/bam_ampliconclip.c:496: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(bam_get_aux(rec_out), orig_aux, orig_l_aux);
data/samtools-1.11/bam_ampliconclip.c:807:25:  [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 ((stats_fp = fopen(param->stats_file, "w")) == NULL) {
data/samtools-1.11/bam_ampliconclip.c:870: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 wmode[4] = {'w', 'b', 0, 0};
data/samtools-1.11/bam_ampliconclip.c:909:43:  [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).
            case 1009: param.filter_len = atoi(optarg); break;
data/samtools-1.11/bam_ampliconclip.c:910:41:  [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).
            case 1010: param.fail_len = atoi(optarg); break;
data/samtools-1.11/bam_cat.c:211: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 vers[100];
data/samtools-1.11/bam_cat.c:212:5:  [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(vers, "%d.%d", vers_maj, vers_min);
data/samtools-1.11/bam_cat.c:419:17:  [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(ebuf,ebuf+len,diff);
data/samtools-1.11/bam_cat.c:420:17:  [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(ebuf+diff,buf,len);
data/samtools-1.11/bam_cat.c:426:17:  [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(ebuf,buf+len,es);
data/samtools-1.11/bam_cat.c:511:21:  [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(infns+infns_size, fns_read, nfns * sizeof(char*));
data/samtools-1.11/bam_cat.c:538: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(infns + infns_size, argv + optind, nargv_fns * sizeof(char*));
data/samtools-1.11/bam_fastq.c:130: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 *fnr[3];
data/samtools-1.11/bam_fastq.c:139: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 *index_file[2];
data/samtools-1.11/bam_fastq.c:573:49:  [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).
            case 'c': opts->compression_level = atoi(optarg); break;
data/samtools-1.11/bam_fastq.c:575:40:  [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).
            case 'v': opts->def_qual = atoi(optarg); break;
data/samtools-1.11/bam_fastq.c:664: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 mode[4] = "w";
data/samtools-1.11/bam_index.c:66:40:  [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).
        case 'm': csi = 1; min_shift = atoi(optarg); break;
data/samtools-1.11/bam_index.c:67:31:  [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).
        case '@': n_threads = atoi(optarg); break;
data/samtools-1.11/bam_lpileup.c:173: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(tv->pre_level, tv->cur_level, tv->n_cur * 4);
data/samtools-1.11/bam_markdup.c:106:18:  [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 sig[13];
data/samtools-1.11/bam_markdup.c:108: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(sig + i, &key.this_ref, 4);      i += 4;
data/samtools-1.11/bam_markdup.c:109: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(sig + i, &key.this_coord, 8);    i += 8;
data/samtools-1.11/bam_markdup.c:110: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(sig + i, &key.orientation, 1);   i += 1;
data/samtools-1.11/bam_markdup.c:114:18:  [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 sig[26];
data/samtools-1.11/bam_markdup.c:116: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(sig + i, &key.this_ref, 4);      i += 4;
data/samtools-1.11/bam_markdup.c:117: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(sig + i, &key.this_coord, 8);    i += 8;
data/samtools-1.11/bam_markdup.c:118: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(sig + i, &key.other_ref, 4);     i += 4;
data/samtools-1.11/bam_markdup.c:119: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(sig + i, &key.other_coord, 8);   i += 8;
data/samtools-1.11/bam_markdup.c:120: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(sig + i, &key.leftmost, 1);      i += 1;
data/samtools-1.11/bam_markdup.c:121: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(sig + i, &key.orientation, 1);   i += 1;
data/samtools-1.11/bam_markdup.c:1664:31:  [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 (NULL == (fp = fopen(param->stats_file, "w"))) {
data/samtools-1.11/bam_markdup.c:1767: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 wmode[4] = {'w', 'b', 0, 0};
data/samtools-1.11/bam_markdup.c:1786:42:  [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).
            case 'l': param.max_length = atoi(optarg); break;
data/samtools-1.11/bam_markdup.c:1792:40:  [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).
            case 'd': param.opt_dist = atoi(optarg); break;
data/samtools-1.11/bam_mate.c:431: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 wmode[4] = {'w', 'b', 0, 0};
data/samtools-1.11/bam_md.c:269:28:  [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).
        case 'n': max_nm = atoi(optarg); break;
data/samtools-1.11/bam_md.c:270:26:  [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).
        case 'C': capQ = atoi(optarg); break;
data/samtools-1.11/bam_plcmd.c:54: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[16];
data/samtools-1.11/bam_plcmd.c:164: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 *ref[2];
data/samtools-1.11/bam_plcmd.c:648:41:  [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).
        pileup_fp = conf->output_fname? fopen(conf->output_fname, "w") : stdout;
data/samtools-1.11/bam_plcmd.c:984: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[MAX_PATH_LEN];
data/samtools-1.11/bam_plcmd.c:992:16:  [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).
    FILE *fh = fopen(file_list,"r");
data/samtools-1.11/bam_plcmd.c:1231:32:  [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).
        case  4 : mplp.openQ = atoi(optarg); break;
data/samtools-1.11/bam_plcmd.c:1247:36:  [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).
        case 'd': mplp.max_depth = atoi(optarg); break;
data/samtools-1.11/bam_plcmd.c:1272:37:  [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).
        case 'C': mplp.capQ_thres = atoi(optarg); break;
data/samtools-1.11/bam_plcmd.c:1273:33:  [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).
        case 'q': mplp.min_mq = atoi(optarg); break;
data/samtools-1.11/bam_plcmd.c:1274:36:  [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).
        case 'Q': mplp.min_baseQ = atoi(optarg); break;
data/samtools-1.11/bam_plcmd.c:1290:31:  [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).
        case 'e': mplp.extQ = atoi(optarg); deprecated(c); break;
data/samtools-1.11/bam_plcmd.c:1291:34:  [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).
        case 'h': mplp.tandemQ = atoi(optarg); deprecated(c); break;
data/samtools-1.11/bam_plcmd.c:1294:38:  [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).
        case 'm': mplp.min_support = atoi(optarg); deprecated(c); break;
data/samtools-1.11/bam_plcmd.c:1295:42:  [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).
        case 'L': mplp.max_indel_depth = atoi(optarg); deprecated(c); break;
data/samtools-1.11/bam_plcmd.c:1298:17:  [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[1024];
data/samtools-1.11/bam_plcmd.c:1300:30:  [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 ((fp_rg = fopen(optarg, "r")) == NULL)
data/samtools-1.11/bam_reheader.c:457:18:  [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).
    int tmp_fd = mkstemp(tmp_fn);
data/samtools-1.11/bam_rmdup.c:273: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 wmode[3] = {'w', 'b', 0};
data/samtools-1.11/bam_sort.c:85: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(target_iter, pattern, 4);
data/samtools-1.11/bam_sort.c:89: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(target_iter, pattern, size%4);
data/samtools-1.11/bam_sort.c:103: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 g_sort_tag[2] = {0,0};
data/samtools-1.11/bam_sort.c:534:17:  [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(new_hdr_line.s + id_offset, transformed_id.s,
data/samtools-1.11/bam_sort.c:946: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(new_rl[i].intervals, rl[i].intervals, new_rl[i].count * sizeof(hts_pair_pos_t));
data/samtools-1.11/bam_sort.c:1388: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 mode[12];
data/samtools-1.11/bam_sort.c:1389:5:  [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(mode, "wb");
data/samtools-1.11/bam_sort.c:1453:27:  [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).
        case 'l': level = atoi(optarg); break;
data/samtools-1.11/bam_sort.c:1456:33:  [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).
        case 's': random_seed = atol(optarg); break;
data/samtools-1.11/bam_sort.c:1471:17:  [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(fn+fn_size, fn_read, nfiles * sizeof(char*));
data/samtools-1.11/bam_sort.c:1500:20:  [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).
        FILE *fp = fopen(argv[optind], "rb");
data/samtools-1.11/bam_sort.c:1525: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(fn+fn_size, argv + (optind+1), nargcfiles * sizeof(char*));
data/samtools-1.11/bam_sort.c:1530: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(fn_idx+fn_size, argv + nargcfiles + (optind+1), nargcfiles * sizeof(char*));
data/samtools-1.11/bam_sort.c:1545:5:  [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(mode, "wb");
data/samtools-1.11/bam_sort.c:1547:21:  [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.
    if (level >= 0) sprintf(strchr(mode, '\0'), "%d", level < 9? level : 9);
data/samtools-1.11/bam_sort.c:2088: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 L[16] = {
data/samtools-1.11/bam_sort.c:2177: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 comp[256] = {
data/samtools-1.11/bam_sort.c:2202: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 seq_[10000], *seq = seq_;
data/samtools-1.11/bam_sort.c:2485:52:  [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.
            buf[k].bam_record->data = (uint8_t *)((char *)buf[k].bam_record + sizeof(bam1_t));
data/samtools-1.11/bam_sort.c:2486: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(buf[k].bam_record->data, b->data, b->l_data);
data/samtools-1.11/bam_sort.c:2660:27:  [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).
        case 'l': level = atoi(optarg); break;
data/samtools-1.11/bam_sort.c:2665:30:  [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).
            minimiser_kmer = atoi(optarg);
data/samtools-1.11/bam_sort.c:2710:5:  [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(modeout, "wb");
data/samtools-1.11/bam_sort.c:2712:21:  [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.
    if (level >= 0) sprintf(strchr(modeout, '\0'), "%d", level < 9? level : 9);
data/samtools-1.11/bam_sort.c:2731: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 dummy[4];
data/samtools-1.11/bam_stat.c:91:21:  [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.
    if (total != 0) sprintf(buffer, "%.2f%%", (float)n / total * 100.0);
data/samtools-1.11/bam_stat.c:92:10:  [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.
    else strcpy(buffer, "N/A");
data/samtools-1.11/bam_stat.c:98:21:  [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.
    if (total != 0) sprintf(buffer, "%.2f", (float)n / total * 100.0);
data/samtools-1.11/bam_stat.c:99:10:  [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.
    else strcpy(buffer, "null");
data/samtools-1.11/bam_stat.c:115: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 b0[16], b1[16];
data/samtools-1.11/bam_stat.c:132: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 b0[16], b1[16];
data/samtools-1.11/bam_stat.c:206: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 b0[16], b1[16];
data/samtools-1.11/bam_tview_curses.c:144: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 str[256], *p;
data/samtools-1.11/bam_tview_html.c:351:20:  [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).
        base->mcol=atoi(colstr);
data/samtools-1.11/bamshuf.c:227:5:  [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(modew, "wb%d", (clevel >= 0 && clevel <= 9)? clevel : DEF_CLEVEL);
data/samtools-1.11/bamshuf.c:595:29:  [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).
        case 'n': n_files = atoi(optarg); break;
data/samtools-1.11/bamshuf.c:596:28:  [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).
        case 'l': clevel = atoi(optarg); break;
data/samtools-1.11/bamshuf.c:601:33:  [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).
        case 'r': reads_store = atoi(optarg); break;
data/samtools-1.11/bedcov.c:90:30:  [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).
        case 'Q': min_mapQ = atoi(optarg); break;
data/samtools-1.11/bedcov.c:109:31:  [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).
        case 'd': min_depth = atoi(optarg); break;
data/samtools-1.11/bedidx.c:491: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 reg[1024];
data/samtools-1.11/coverage.c:90: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.
static const char *const BLOCK_CHARS8[8] = {"\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"};
data/samtools-1.11/coverage.c:92: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.
static const char *const BLOCK_CHARS2[2] = {"\u2584", "\u2588"};
data/samtools-1.11/coverage.c:99: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.
static const char *const BLOCK_CHARS8[8] = {
data/samtools-1.11/coverage.c:103: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.
static const char *const BLOCK_CHARS2[2] = {"\xE2\x96\x84", "\xE2\x96\x88"};
data/samtools-1.11/coverage.c:227: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[30];
data/samtools-1.11/coverage.c:274: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 buf2[50];
data/samtools-1.11/coverage.c:356:37:  [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).
            case 'L': opt_min_len = atoi(optarg); break;
data/samtools-1.11/coverage.c:357:38:  [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).
            case 'q': opt_min_mapQ = atoi(optarg); break;
data/samtools-1.11/coverage.c:358:39:  [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).
            case 'Q': opt_min_baseQ = atoi(optarg); break;
data/samtools-1.11/coverage.c:359:36:  [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).
            case 'w': opt_n_bins = atoi(optarg); opt_full_width = false;
data/samtools-1.11/coverage.c:394:20:  [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).
        file_out = fopen( opt_output_file, "w" );
data/samtools-1.11/coverage.c:417:23:  [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).
            columns = atoi(env_columns); // atoi(NULL) returns 0
data/samtools-1.11/cut_target.c:190:37:  [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).
            case 'Q': g.min_baseQ = atoi(optarg); break; // quality cutoff
data/samtools-1.11/cut_target.c:191:42:  [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).
            case 'i': g_param.p[0][1] = -atoi(optarg); break; // 0->1 transition (in) PENALTY
data/samtools-1.11/cut_target.c:192:41:  [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).
            case '0': g_param.e[1][0] = atoi(optarg); break; // emission SCORE
data/samtools-1.11/cut_target.c:193:41:  [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).
            case '1': g_param.e[1][1] = atoi(optarg); break;
data/samtools-1.11/cut_target.c:194:41:  [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).
            case '2': g_param.e[1][2] = atoi(optarg); break;
data/samtools-1.11/dict.c:51: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 digest[16];
data/samtools-1.11/dict.c:52: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 hex[33];
data/samtools-1.11/dict.c:61:15:  [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).
        out = fopen(args->output_fname, "w");
data/samtools-1.11/faidx.c:51:17:  [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 unsigned char comp_base[256] = {
data/samtools-1.11/faidx.c:269:34:  [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).
            case 'n': line_len = atoi(optarg);
data/samtools-1.11/faidx.c:300:21:  [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(pos_strand_name, optarg + 7, comma);
data/samtools-1.11/faidx.c:303:25:  [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(neg_strand_name, optarg + 7 + comma + 1,
data/samtools-1.11/faidx.c:364:20:  [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).
        file_out = fopen( output_file, "w" );
data/samtools-1.11/lz4/lz4.c:218: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(memPtr, &value, sizeof(value));
data/samtools-1.11/lz4/lz4.c:223: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(memPtr, &value, sizeof(value));
data/samtools-1.11/lz4/lz4.c:252: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(dst,src,8);
data/samtools-1.11/lz4/lz4.c:668: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(op, anchor, lastRun);
data/samtools-1.11/lz4/lz4.c:885: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(op, anchor, lastRunSize);
data/samtools-1.11/lz4/lz4.c:1176: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(op, ip, length);
data/samtools-1.11/lz4/lz4.c:1215:17:  [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(op, dictEnd - copySize, copySize);
data/samtools-1.11/lz4/lz4.c:1222:21:  [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(op, lowPrefix, restSize);
data/samtools-1.11/lz4/lz4.c:1237: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(op+4, match, 4);
data/samtools-1.11/misc/ace2sam.c:158:25:  [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).
                    q = atoi(s.s) + 33;
data/samtools-1.11/misc/ace2sam.c:178:50:  [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).
            ks_getuntil(ks, 0, &s, &dret); pos = atoi(s.s); neg = pos < 0? 1 : 0; pos = pos < 0? -pos : pos; // position
data/samtools-1.11/misc/ace2sam.c:194:50:  [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).
            ks_getuntil(ks, 0, &s, &dret); beg = atoi(s.s) - 1; // align clipping start
data/samtools-1.11/misc/ace2sam.c:195:50:  [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).
            ks_getuntil(ks, 0, &s, &dret); end = atoi(s.s); // clipping end
data/samtools-1.11/misc/maq2sam.c:62: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 name[MAX_NAMELEN];
data/samtools-1.11/misc/md5fa.c:40: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 unordered[16], digest[16];
data/samtools-1.11/misc/md5fa.c:41: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 hex[33];
data/samtools-1.11/misc/md5sum-lite.c:34: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 buf[4096], digest[16];
data/samtools-1.11/misc/md5sum-lite.c:35: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 hex[33];
data/samtools-1.11/misc/md5sum-lite.c:40:27:  [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).
    fp = strcmp(fn, "-")? fopen(fn, "r") : stdin;
data/samtools-1.11/misc/wgsim.c:446:26:  [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).
        case 'd': dist = atoi(optarg); break;
data/samtools-1.11/misc/wgsim.c:447:29:  [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).
        case 's': std_dev = atoi(optarg); break;
data/samtools-1.11/misc/wgsim.c:448:23:  [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).
        case 'N': N = atoi(optarg); break;
data/samtools-1.11/misc/wgsim.c:449:28:  [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).
        case '1': size_l = atoi(optarg); break;
data/samtools-1.11/misc/wgsim.c:450:28:  [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).
        case '2': size_r = atoi(optarg); break;
data/samtools-1.11/misc/wgsim.c:456:26:  [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).
        case 'S': seed = atoi(optarg); break;
data/samtools-1.11/misc/wgsim.c:461:14:  [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).
    fpout1 = fopen(argv[optind+1], "w");
data/samtools-1.11/misc/wgsim.c:462:14:  [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).
    fpout2 = fopen(argv[optind+2], "w");
data/samtools-1.11/padding.c:69: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(b->data + b->core.l_qname, cigar, n * 4);
data/samtools-1.11/padding.c:412: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 len_buf[64];
data/samtools-1.11/padding.c:424: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(len_buf, "%"PRIhts_pos"", unpadded_len);
data/samtools-1.11/padding.c:450: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 in_mode[5], out_mode[6], *fn_out = 0, *fn_fai = 0, *fn_out_idx = NULL;
data/samtools-1.11/padding.c:490: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 tmp[2];
data/samtools-1.11/padding.c:526: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 wmode[2];
data/samtools-1.11/phase.c:61: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 *out_name[3];
data/samtools-1.11/phase.c:528:51:  [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).
                uint64_t x = (uint64_t)tid<<32 | (atoi(str->s) - 1);
data/samtools-1.11/phase.c:610:37:  [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).
            case 'D': g.max_depth = atoi(optarg); break;
data/samtools-1.11/phase.c:611:38:  [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).
            case 'q': g.min_varLOD = atoi(optarg); break;
data/samtools-1.11/phase.c:612:37:  [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).
            case 'Q': g.min_baseQ = atoi(optarg); break;
data/samtools-1.11/phase.c:613:29:  [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).
            case 'k': g.k = atoi(optarg); break;
data/samtools-1.11/sam.c:134:5:  [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(strcpy(fn_list, fn_ref), ".fai");
data/samtools-1.11/sam_opts.c:91:28:  [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).
            ga->nthreads = atoi(optarg);
data/samtools-1.11/sam_opts.c:97:27:  [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).
            hts_verbose = atoi(optarg);
data/samtools-1.11/sam_view.c:157: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[1024];
data/samtools-1.11/sam_view.c:167:10:  [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).
    fp = fopen(fn, "r");
data/samtools-1.11/sam_view.c:216: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[1024];
data/samtools-1.11/sam_view.c:226:10:  [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).
    fp = fopen(fn, "r");
data/samtools-1.11/sam_view.c:268: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 out_mode[5], out_un_mode[5], *out_format = "";
data/samtools-1.11/sam_view.c:334:39:  [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).
        case 'm': settings.min_qlen = atoi(optarg); break;
data/samtools-1.11/sam_view.c:348:39:  [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).
        case 'q': settings.min_mapQ = atoi(optarg); break;
data/samtools-1.11/sam_view.c:390:17:  [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(settings.tag, optarg, 2);
data/samtools-1.11/sam_view.c:420:17:  [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(settings.tag, optarg, 2);
data/samtools-1.11/sam_view.c:480: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 tmp[2];
data/samtools-1.11/sam_view.c:591:22:  [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).
            fp_out = fopen(fn_out, "w");
data/samtools-1.11/stats.c:131: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 tag_name[3];
data/samtools-1.11/stats.c:132: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 qual_name[3];
data/samtools-1.11/stats.c:708: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(rbuffer,stats->cov_rbuf.buffer+stats->cov_rbuf.start,n);
data/samtools-1.11/stats.c:710: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(rbuffer+n,stats->cov_rbuf.buffer,stats->cov_rbuf.start);
data/samtools-1.11/stats.c:1825:16:  [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).
    FILE *fp = fopen(file,"r");
data/samtools-1.11/stats.c:2146:20:  [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).
        FILE *to = fopen(output_filename.s, "w");
data/samtools-1.11/stats.c:2416:46:  [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).
            case 'l': info->filter_readlen = atoi(optarg); break;
data/samtools-1.11/stats.c:2417:38:  [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).
            case 'i': info->nisize = atoi(optarg); break;
data/samtools-1.11/stats.c:2419:41:  [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).
            case 'q': info->trim_qual = atoi(optarg); break;
data/samtools-1.11/stats.c:2426:45:  [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).
            case 'g': info->cov_threshold = atoi(optarg);
data/samtools-1.11/test/merge/test_bam_translate.c:125: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(b->data,
data/samtools-1.11/test/merge/test_bam_translate.c:165: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(b->data,
data/samtools-1.11/test/merge/test_bam_translate.c:206: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(b->data,
data/samtools-1.11/test/merge/test_bam_translate.c:243: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(b->data,
data/samtools-1.11/test/merge/test_bam_translate.c:281: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(b->data,
data/samtools-1.11/test/merge/test_bam_translate.c:324: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(b->data,
data/samtools-1.11/test/merge/test_bam_translate.c:387:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/merge/test_bam_translate.c:425:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/merge/test_bam_translate.c:463:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/merge/test_bam_translate.c:500:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/merge/test_bam_translate.c:537:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/merge/test_bam_translate.c:575:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/split/test_count_rg.c:97:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/split/test_expand_format_string.c:101:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/split/test_filter_header_rg.c:211:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/split/test_filter_header_rg.c:254:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/split/test_filter_header_rg.c:296:13:  [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).
    check = fopen(tempfname, "r");
data/samtools-1.11/test/split/test_parse_args.c:128:20:  [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).
    check_stdout = fopen(tempfname_stdout, "r");
data/samtools-1.11/test/split/test_parse_args.c:129:20:  [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).
    check_stderr = fopen(tempfname_stderr, "r");
data/samtools-1.11/test/split/test_parse_args.c:179:20:  [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).
    check_stdout = fopen(tempfname_stdout, "r");
data/samtools-1.11/test/split/test_parse_args.c:180:20:  [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).
    check_stderr = fopen(tempfname_stderr, "r");
data/samtools-1.11/test/test.c:51: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).
    int fd = open(path, O_WRONLY|O_TRUNC|O_CREAT, 0666);
data/samtools-1.11/tmp_file.c:114:19:  [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(tmp->name, O_RDWR|O_CREAT|O_EXCL, 0600)) == -1) {
data/samtools-1.11/tmp_file.c:266: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(tmp->ring_index, inbam, sizeof(bam1_t));
data/samtools-1.11/tmp_file.c:267: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(tmp->ring_index + sizeof(bam1_t) , inbam->data, inbam->l_data);
data/samtools-1.11/tmp_file.c:381: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(inbam, tmp->ring_index, sizeof(bam1_t));
data/samtools-1.11/tmp_file.c:400: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(inbam->data, tmp->ring_index + entry_size, inbam->l_data);
data/samtools-1.11/amplicon_stats.c:1228: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).
            char *nend = filev[i] + strlen(filev[i]), *cp;
data/samtools-1.11/bam_addrprg.c:98:24:  [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).
    out = ptr = malloc(strlen(in)+1);
data/samtools-1.11/bam_addrprg.c:144: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).
    size_t len = slim? (slim - s) : strlen(s);
data/samtools-1.11/bam_addrprg.c:208:25:  [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 (strlen(optarg)<3 || (optarg[0] != '@' && optarg[1] != 'R' && optarg[2] != 'G')) {
data/samtools-1.11/bam_addrprg.c:298:15:  [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 len = strlen(state->rg_id)+1;
data/samtools-1.11/bam_addrprg.c:312:15:  [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 len = strlen(state->rg_id)+1;
data/samtools-1.11/bam_addrprg.c:342:9:  [1] (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 character.
        strcat(output_mode, "0");
data/samtools-1.11/bam_addrprg.c:344: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).
        sam_open_mode(output_mode + strlen(output_mode),
data/samtools-1.11/bam_addrprg.c:367:75:  [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 (-1 == sam_hdr_add_lines(retval->output_header, opts->rg_line, strlen(opts->rg_line))) {
data/samtools-1.11/bam_color.c:51: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).
        i = strlen(cs) - 1 - i;
data/samtools-1.11/bam_color.c:80: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).
        i = strlen(cq) - 1 - i;
data/samtools-1.11/bam_color.c:141: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).
        cs_i = strlen(cs) - 1 - i;
data/samtools-1.11/bam_fastq.c:177: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(str)-1,j=0;
data/samtools-1.11/bam_fastq.c:197:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (!read) return NULL;
data/samtools-1.11/bam_fastq.c:200:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (rec->core.flag & BAM_FREVERSE) read[n] = seq_nt16_str[seq_comp_table[bam_seqi(seq,n)]];
data/samtools-1.11/bam_fastq.c:201:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        else                               read[n] = seq_nt16_str[bam_seqi(seq,n)];
data/samtools-1.11/bam_fastq.c:203:48:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (rec->core.flag & BAM_FREVERSE) reverse(read);
data/samtools-1.11/bam_fastq.c:204:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    return read;
data/samtools-1.11/bam_fastq.c:284:46:  [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 (ks_resize(&new, linebuf->l + strlen(index_sequence) + 16) < 0)
data/samtools-1.11/bam_fastq.c:355:23:  [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 len = strlen(seq);
data/samtools-1.11/bam_fastq.c:390:15:  [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).
    tag_len = strlen(tag);
data/samtools-1.11/bam_fastq.c:435:79:  [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 *new_index_sequence = realloc(state->index_sequence, strlen(state->index_sequence) + strlen(sub_tag) + 2);
data/samtools-1.11/bam_fastq.c:435:111:  [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 *new_index_sequence = realloc(state->index_sequence, strlen(state->index_sequence) + strlen(sub_tag) + 2);
data/samtools-1.11/bam_fastq.c:665:18:  [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).
    size_t len = strlen(filename);
data/samtools-1.11/bam_fastq.c:708:17:  [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 (strlen(s) != 2) {
data/samtools-1.11/bam_markdup.c:817:44:  [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 (bam_aux_append(dup, "do", 'Z', strlen(bam_get_qname(ori)) + 1, (uint8_t*)bam_get_qname(ori))) {
data/samtools-1.11/bam_markdup.c:931:67:  [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 (bam_aux_append(current->b, "do", 'Z', strlen(ori_name) + 1, (uint8_t*)ori_name)) {
data/samtools-1.11/bam_markdup.c:1611:58:  [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 (bam_aux_append(b, "do", 'Z', strlen(kh_val(dup_hash, k).name) + 1, (uint8_t*)kh_val(dup_hash, k).name)) {
data/samtools-1.11/bam_md.c:167:17:  [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 (strlen((char*)old_md+1) == str.l) {
data/samtools-1.11/bam_md.c:257:5:  [1] (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 character.
    strcpy(mode_w, "w");
data/samtools-1.11/bam_md.c:281:21:  [1] (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 character.
    if (is_bam_out) strcat(mode_w, "b");
data/samtools-1.11/bam_md.c:282:10:  [1] (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 character.
    else strcat(mode_w, "h");
data/samtools-1.11/bam_md.c:283:26:  [1] (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 character.
    if (is_uncompressed) strcat(mode_w, "0");
data/samtools-1.11/bam_plcmd.c:217:17:  [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 (strlen(tag) != 2) {
data/samtools-1.11/bam_plcmd.c:1004:15:  [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).
        len = strlen(buf);
data/samtools-1.11/bam_reheader.c:478:20:  [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 comm_len = strlen(external) + strlen(tmp_fn) + 8;
data/samtools-1.11/bam_reheader.c:478:39:  [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 comm_len = strlen(external) + strlen(tmp_fn) + 8;
data/samtools-1.11/bam_sort.c:629:34:  [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 (!end) end = id + strlen(id);
data/samtools-1.11/bam_sort.c:844:46:  [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).
                bam_aux_append(b, "RG", 'Z', strlen(translate_rg) + 1,
data/samtools-1.11/bam_sort.c:874:46:  [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).
                bam_aux_append(b, "PG", 'Z', strlen(translate_pg) + 1,
data/samtools-1.11/bam_sort.c:1059:21:  [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 l = strlen(fn[i]);
data/samtools-1.11/bam_sort.c:1068:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy(RG[i], s + j, l);
data/samtools-1.11/bam_sort.c:1390:30:  [1] (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 character.
    if (flag & MERGE_UNCOMP) strcat(mode, "0");
data/samtools-1.11/bam_sort.c:1391:35:  [1] (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 character.
    else if (flag & MERGE_LEVEL1) strcat(mode, "1");
data/samtools-1.11/bam_sort.c:2274: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).
    name = (char*)calloc(strlen(w->prefix) + 20, 1);
data/samtools-1.11/bam_sort.c:2545:36:  [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).
            fns[i] = (char*)calloc(strlen(prefix) + 20, 1);
data/samtools-1.11/bam_sort.c:2585: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).
    char *fnout = calloc(strlen(prefix) + 4 + 1, 1);
data/samtools-1.11/bam_tview.c:367: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).
        str = (char*)calloc(strlen(ref_name) + 30, 1);
data/samtools-1.11/bamshuf.c:225:9:  [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).
    l = strlen(pre);
data/samtools-1.11/bamshuf.c:241: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).
        j = strlen(modew);
data/samtools-1.11/bedidx.c:523:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy(reg, regs[i], q - regs[i]);
data/samtools-1.11/bedidx.c:527:17:  [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 (strlen(regs[i]) + 1 > 1024) {
data/samtools-1.11/coverage.c:149:15:  [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 len = strlen(text);
data/samtools-1.11/faidx.c:291:34:  [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).
                    size_t len = strlen(optarg + 7);
data/samtools-1.11/misc/maq2sam.c:167:21:  [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 l = strlen(m1->name);
data/samtools-1.11/padding.c:462:5:  [1] (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 character.
    strcpy(in_mode, "r"); strcpy(out_mode, "w");
data/samtools-1.11/padding.c:462:27:  [1] (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 character.
    strcpy(in_mode, "r"); strcpy(out_mode, "w");
data/samtools-1.11/padding.c:488:5:  [1] (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 character.
    strcat(out_mode, "h");
data/samtools-1.11/sam.c:133:22:  [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).
    fn_list = calloc(strlen(fn_ref) + 5, 1);
data/samtools-1.11/sam_opts.c:68: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).
            char *ref = malloc(10 + strlen(optarg) + 1);
data/samtools-1.11/sam_utils.c:110:18:  [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).
        delim += strlen(HTS_IDX_DELIM);
data/samtools-1.11/sam_utils.c:116:20:  [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).
        size_t l = strlen(fn_idx);
data/samtools-1.11/sam_utils.c:124:25:  [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).
        fn_idx = malloc(strlen(fn)+6);
data/samtools-1.11/sam_view.c:173:38:  [1] (buffer) fscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
    while (ret != -1 && !feof(fp) && fscanf(fp, "%1023s", buf) > 0) {
data/samtools-1.11/sam_view.c:232:38:  [1] (buffer) fscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
    while (ret != -1 && !feof(fp) && fscanf(fp, "%1023s", buf) > 0) {
data/samtools-1.11/sam_view.c:300:5:  [1] (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 character.
    strcpy(out_mode, "w");
data/samtools-1.11/sam_view.c:301:5:  [1] (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 character.
    strcpy(out_un_mode, "w");
data/samtools-1.11/sam_view.c:372:17:  [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 (strlen(optarg) < 4 || optarg[2] != ':') {
data/samtools-1.11/sam_view.c:402:17:  [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 (strlen(optarg) < 4 || (optarg[2] != ':' && optarg[2] != ';')) {
data/samtools-1.11/sam_view.c:452:21:  [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 (strlen(optarg) != 2) {
data/samtools-1.11/stats.c:501:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            uint8_t cread = bam_seqi(read,iread);
data/samtools-1.11/stats.c:753:32:  [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).
        uint32_t barcode_len = strlen(barcode);
data/samtools-1.11/stats.c:831:32:  [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).
        uint32_t barqual_len = strlen(barqual);
data/samtools-1.11/test/merge/test_trans_tbl_init.c:74:66:  [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 (!bam0 || -1 == sam_hdr_add_lines(bam0, bam0_header_text, strlen(bam0_header_text)))
data/samtools-1.11/test/merge/test_trans_tbl_init.c:80:66:  [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 (!bam1 || -1 == sam_hdr_add_lines(bam1, bam1_header_text, strlen(bam1_header_text)))
data/samtools-1.11/test/merge/test_trans_tbl_init.c:120:41:  [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).
        || sam_hdr_length(translate) != strlen( test_1_trans_text)
data/samtools-1.11/test/merge/test_trans_tbl_init.c:160:38:  [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 (sam_hdr_length(translate) != strlen(test_2_trans_text)
data/samtools-1.11/test/merge/test_trans_tbl_init.c:205:41:  [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).
        || sam_hdr_length(translate) != strlen(test_3_trans_text)
data/samtools-1.11/test/merge/test_trans_tbl_init.c:237:41:  [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).
        || sam_hdr_length(translate) != strlen(test_4_trans_text)
data/samtools-1.11/test/merge/test_trans_tbl_init.c:273:41:  [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).
        || sam_hdr_length(translate) != strlen(test_5_trans_text)
data/samtools-1.11/test/merge/test_trans_tbl_init.c:302:41:  [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).
        || sam_hdr_length(translate) != strlen(test_5_trans_text)
data/samtools-1.11/tmp_file.c:101: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).
    if ((tmp->name = malloc(strlen(tmp_name) + 7)) == NULL) {

ANALYSIS SUMMARY:

Hits = 441
Lines analyzed = 34422 in approximately 1.67 seconds (20634 lines/second)
Physical Source Lines of Code (SLOC) = 25736
Hits@level = [0] 1247 [1]  82 [2] 243 [3]  65 [4]  51 [5]   0
Hits@level+ = [0+] 1688 [1+] 441 [2+] 359 [3+] 116 [4+]  51 [5+]   0
Hits/KSLOC@level+ = [0+] 65.5891 [1+] 17.1355 [2+] 13.9493 [3+] 4.5073 [4+] 1.98166 [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.