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-legacy-0.1.19+dfsg/bam.c Examining data/samtools-legacy-0.1.19+dfsg/bam.h Examining data/samtools-legacy-0.1.19+dfsg/bam2bcf.c Examining data/samtools-legacy-0.1.19+dfsg/bam2bcf.h Examining data/samtools-legacy-0.1.19+dfsg/bam2bcf_indel.c Examining data/samtools-legacy-0.1.19+dfsg/bam_aux.c Examining data/samtools-legacy-0.1.19+dfsg/bam_cat.c Examining data/samtools-legacy-0.1.19+dfsg/bam_color.c Examining data/samtools-legacy-0.1.19+dfsg/bam_endian.h Examining data/samtools-legacy-0.1.19+dfsg/bam_import.c Examining data/samtools-legacy-0.1.19+dfsg/bam_index.c Examining data/samtools-legacy-0.1.19+dfsg/bam_lpileup.c Examining data/samtools-legacy-0.1.19+dfsg/bam_mate.c Examining data/samtools-legacy-0.1.19+dfsg/bam_md.c Examining data/samtools-legacy-0.1.19+dfsg/bam_pileup.c Examining data/samtools-legacy-0.1.19+dfsg/bam_reheader.c Examining data/samtools-legacy-0.1.19+dfsg/bam_rmdup.c Examining data/samtools-legacy-0.1.19+dfsg/bam_rmdupse.c Examining data/samtools-legacy-0.1.19+dfsg/bam_sort.c Examining data/samtools-legacy-0.1.19+dfsg/bam_stat.c Examining data/samtools-legacy-0.1.19+dfsg/bam_tview.c Examining data/samtools-legacy-0.1.19+dfsg/bam_tview.h Examining data/samtools-legacy-0.1.19+dfsg/bam_tview_curses.c Examining data/samtools-legacy-0.1.19+dfsg/bam_tview_html.c Examining data/samtools-legacy-0.1.19+dfsg/bamshuf.c Examining data/samtools-legacy-0.1.19+dfsg/bamtk.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/bcf.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/bcf.h Examining data/samtools-legacy-0.1.19+dfsg/bcftools/bcf2qcall.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/em.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/fet.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/index.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/kfunc.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/kmin.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/kmin.h Examining data/samtools-legacy-0.1.19+dfsg/bcftools/main.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/mut.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.c Examining data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.h Examining data/samtools-legacy-0.1.19+dfsg/bcftools/vcf.c Examining data/samtools-legacy-0.1.19+dfsg/bedcov.c Examining data/samtools-legacy-0.1.19+dfsg/bedidx.c Examining data/samtools-legacy-0.1.19+dfsg/bgzf.c Examining data/samtools-legacy-0.1.19+dfsg/bgzf.h Examining data/samtools-legacy-0.1.19+dfsg/bgzip.c Examining data/samtools-legacy-0.1.19+dfsg/cut_target.c Examining data/samtools-legacy-0.1.19+dfsg/errmod.c Examining data/samtools-legacy-0.1.19+dfsg/errmod.h Examining data/samtools-legacy-0.1.19+dfsg/examples/bam2bed.c Examining data/samtools-legacy-0.1.19+dfsg/examples/calDepth.c Examining data/samtools-legacy-0.1.19+dfsg/examples/chk_indel.c Examining data/samtools-legacy-0.1.19+dfsg/faidx.c Examining data/samtools-legacy-0.1.19+dfsg/faidx.h Examining data/samtools-legacy-0.1.19+dfsg/kaln.c Examining data/samtools-legacy-0.1.19+dfsg/kaln.h Examining data/samtools-legacy-0.1.19+dfsg/khash.h Examining data/samtools-legacy-0.1.19+dfsg/klist.h Examining data/samtools-legacy-0.1.19+dfsg/knetfile.c Examining data/samtools-legacy-0.1.19+dfsg/knetfile.h Examining data/samtools-legacy-0.1.19+dfsg/kprobaln.c Examining data/samtools-legacy-0.1.19+dfsg/kprobaln.h Examining data/samtools-legacy-0.1.19+dfsg/kseq.h Examining data/samtools-legacy-0.1.19+dfsg/ksort.h Examining data/samtools-legacy-0.1.19+dfsg/kstring.c Examining data/samtools-legacy-0.1.19+dfsg/kstring.h Examining data/samtools-legacy-0.1.19+dfsg/misc/ace2sam.c Examining data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c Examining data/samtools-legacy-0.1.19+dfsg/misc/maq2sam.c Examining data/samtools-legacy-0.1.19+dfsg/misc/md5.c Examining data/samtools-legacy-0.1.19+dfsg/misc/md5.h Examining data/samtools-legacy-0.1.19+dfsg/misc/md5fa.c Examining data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c Examining data/samtools-legacy-0.1.19+dfsg/padding.c Examining data/samtools-legacy-0.1.19+dfsg/phase.c Examining data/samtools-legacy-0.1.19+dfsg/razf.c Examining data/samtools-legacy-0.1.19+dfsg/razf.h Examining data/samtools-legacy-0.1.19+dfsg/razip.c Examining data/samtools-legacy-0.1.19+dfsg/sam.c Examining data/samtools-legacy-0.1.19+dfsg/sam.h Examining data/samtools-legacy-0.1.19+dfsg/sam_header.c Examining data/samtools-legacy-0.1.19+dfsg/sam_header.h Examining data/samtools-legacy-0.1.19+dfsg/sam_view.c Examining data/samtools-legacy-0.1.19+dfsg/sample.c Examining data/samtools-legacy-0.1.19+dfsg/sample.h Examining data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c Examining data/samtools-legacy-0.1.19+dfsg/bam2depth.c FINAL RESULTS: data/samtools-legacy-0.1.19+dfsg/bam_import.c:89:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(s, str->s); data/samtools-legacy-0.1.19+dfsg/bam_index.c:402:2: [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(fnidx, fn); strcat(fnidx, ".bai"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:407:4: [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(fnidx, fn); data/samtools-legacy-0.1.19+dfsg/bam_index.c:464:10: [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(fnidx, fn), ".bai"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:492:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(fnidx, fn); strcat(fnidx, ".bai"); data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:558:28: [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-legacy-0.1.19+dfsg/bam_sort.c:342:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(newtext, "@HD\tVN:1.3\tSO:%s\n", so); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:343:3: [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(newtext, h->text); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:348:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(newtext + (beg - h->text), "\tSO:%s", so); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:349:3: [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(newtext, end); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:392:2: [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-legacy-0.1.19+dfsg/bam_sort.c:495:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf(fnout, "%s%s", prefix, suffix); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:510:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fns[i], "%s.%.4d%s", prefix, i, suffix); data/samtools-legacy-0.1.19+dfsg/bam_tview.c:259:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s:%d-%d", tv->header->target_name[tv->curr_tid], tv->left_pos + 1, tv->left_pos + tv->mcol); data/samtools-legacy-0.1.19+dfsg/bam_tview.c:296: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-legacy-0.1.19+dfsg/bam_tview_curses.c:64:2: [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-legacy-0.1.19+dfsg/bam_tview_html.c:46:9: [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-legacy-0.1.19+dfsg/bamshuf.c:68:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fnt[i], "%s.%.4d.bam", pre, i); data/samtools-legacy-0.1.19+dfsg/bamshuf.c:87:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fnw, "%s.bam", pre); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:223:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(sam[n], s.s); data/samtools-legacy-0.1.19+dfsg/bcftools/fet.c:105:9: [4] (buffer) scanf: 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 (scanf("%s%d%d%d%d", id, &n11, &n12, &n21, &n22) == 5) { data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:211:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcpy(fnidx, fn), ".bci"); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:256:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(fnidx, fn); strcat(fnidx, ".bci"); data/samtools-legacy-0.1.19+dfsg/bgzip.c:125:5: [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(name, argv[optind]); data/samtools-legacy-0.1.19+dfsg/faidx.c:195:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s.fai", fn); data/samtools-legacy-0.1.19+dfsg/faidx.c:264:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s.fai", fn); data/samtools-legacy-0.1.19+dfsg/knetfile.c:311:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fp->retr, "RETR %s\r\n", p); data/samtools-legacy-0.1.19+dfsg/knetfile.c:313:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fp->size_cmd, "SIZE %s\r\n", p); data/samtools-legacy-0.1.19+dfsg/knetfile.c:412:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. l += sprintf(buf + l, "GET %s HTTP/1.0\r\nHost: %s\r\n", fp->path, fp->http_host); data/samtools-legacy-0.1.19+dfsg/kstring.c:13:6: [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. l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); // This line does not work with glibc 2.0. See `man snprintf'. data/samtools-legacy-0.1.19+dfsg/kstring.c:20:7: [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. l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1324: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-legacy-0.1.19+dfsg/padding.c:367:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(newtext, header->text); data/samtools-legacy-0.1.19+dfsg/padding.c:409:3: [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-legacy-0.1.19+dfsg/phase.c:563:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(s, g.pre); strcat(s, ".0.bam"); g.out[0] = bam_open(s, "w"); data/samtools-legacy-0.1.19+dfsg/phase.c:564:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(s, g.pre); strcat(s, ".1.bam"); g.out[1] = bam_open(s, "w"); data/samtools-legacy-0.1.19+dfsg/phase.c:565:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(s, g.pre); strcat(s, ".chimera.bam"); g.out[2] = bam_open(s, "w"); data/samtools-legacy-0.1.19+dfsg/razip.c:83:5: [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(name, argv[optind]); data/samtools-legacy-0.1.19+dfsg/sam.c:173:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcpy(fn_list, fn_ref), ".fai"); data/samtools-legacy-0.1.19+dfsg/sam.c:174:6: [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-legacy-0.1.19+dfsg/sam.c:175:7: [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-legacy-0.1.19+dfsg/sam_header.c:58: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, ap); data/samtools-legacy-0.1.19+dfsg/sam_header.c:556:21: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. nout += sprintf(out+nout,"%s", tag->value); data/samtools-legacy-0.1.19+dfsg/sam_view.c:186:3: [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-legacy-0.1.19+dfsg/sam_view.c:197:26: [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 bear me... data/samtools-legacy-0.1.19+dfsg/bam2depth.c:53:14: [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 ((n = getopt(argc, argv, "r:b:q:Q:l:f:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_aux.c:213:8: [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 drand48() data/samtools-legacy-0.1.19+dfsg/bam_cat.c:163:14: [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, "h:o:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_mate.c:115: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, "r")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_md.c:320:14: [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, "EqreuNhbSC:n:Ad")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:513:14: [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:M:q:Q:uaRC:BDSd:L:b:P:po:e:h:Im:F:EG:6OsV1:2:",lopts,NULL)) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_rmdup.c:183:14: [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, "sS")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_sort.c:270:14: [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, "h:nru1R:f@:l:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_sort.c:540:14: [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, "fnom:@:l:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_tview.c:313: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, "s:p:d:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bam_tview_html.c:293:15: [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-legacy-0.1.19+dfsg/bamshuf.c:121:14: [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, "n:l:uO")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:10:20: [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. #define srand48(x) srand(x) data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:11:9: [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. #define drand48() ((double)rand() / RAND_MAX) data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:364:13: [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. j = (int)(drand48() * i); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:12:20: [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. #define srand48(x) srand(x) data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:13:9: [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. #define lrand48() rand() data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:347:14: [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, "FN1:l:cC:eHAGvbSuP:t:p:QgLi:IMs:D:U:X:d:T:Ywm:K:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:448:46: [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. for (c = 0; c < vc.n_perm; ++c) seeds[c] = lrand48(); data/samtools-legacy-0.1.19+dfsg/bedcov.c:41:14: [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, "Q:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/bedidx.c:8:9: [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. #define drand48() ((double)rand() / RAND_MAX) data/samtools-legacy-0.1.19+dfsg/bgzip.c:87:14: [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, "cdhfb:s:")) >= 0){ data/samtools-legacy-0.1.19+dfsg/cut_target.c:145:14: [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, "f:Q:i:o:0:1:2:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/knetfile.c:386:10: [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. proxy = getenv("http_proxy"); data/samtools-legacy-0.1.19+dfsg/kprobaln.c:255:14: [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, "b:q:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/ksort.h:263:14: [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. j = (int)(drand48() * i); \ data/samtools-legacy-0.1.19+dfsg/misc/ace2sam.c:74:14: [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-legacy-0.1.19+dfsg/misc/bamcheck.c:1381: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,"?hdsr:c:l:i:t:m:q:f:F:I:1:",loptions,NULL))>0 ) data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:73:15: [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-legacy-0.1.19+dfsg/misc/wgsim.c:74:15: [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-legacy-0.1.19+dfsg/misc/wgsim.c:118: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-legacy-0.1.19+dfsg/misc/wgsim.c:124: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. if (c < 4 && drand48() < MUT_RATE) { // mutation data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:125:8: [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-legacy-0.1.19+dfsg/misc/wgsim.c:126: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. double r = drand48(); data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:128:19: [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-legacy-0.1.19+dfsg/misc/wgsim.c:131:10: [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-legacy-0.1.19+dfsg/misc/wgsim.c:134:9: [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-legacy-0.1.19+dfsg/misc/wgsim.c:135:20: [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-legacy-0.1.19+dfsg/misc/wgsim.c:139: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-legacy-0.1.19+dfsg/misc/wgsim.c:146: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-legacy-0.1.19+dfsg/misc/wgsim.c:147: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-legacy-0.1.19+dfsg/misc/wgsim.c:149:20: [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-legacy-0.1.19+dfsg/misc/wgsim.c:152:11: [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-legacy-0.1.19+dfsg/misc/wgsim.c:272: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. pos = (int)((l - d + 1) * drand48()); data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:276:8: [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-legacy-0.1.19+dfsg/misc/wgsim.c:286:18: [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-legacy-0.1.19+dfsg/misc/wgsim.c:327: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. } else if (drand48() < ERR_RATE) { data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:392:14: [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:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/padding.c:389:14: [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, "Sso:u1T:?")) >= 0) { data/samtools-legacy-0.1.19+dfsg/phase.c:314:13: [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-legacy-0.1.19+dfsg/phase.c:337: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. if (which == 3) which = (drand48() < 0.5); data/samtools-legacy-0.1.19+dfsg/phase.c:526:14: [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, "Q:eFq:k:b:l:D:A:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/razip.c:56:14: [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, "cdlhfb:s:")) >= 0){ data/samtools-legacy-0.1.19+dfsg/sam_view.c:138:14: [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, "SbBct:h1Ho:q:f:F:ul:r:xX?T:R:L:s:Q:@:m:")) >= 0) { data/samtools-legacy-0.1.19+dfsg/sam_view.c:142:5: [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(g_subsam_seed); data/samtools-legacy-0.1.19+dfsg/sam_view.c:381:14: [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, "n")) > 0) data/samtools-legacy-0.1.19+dfsg/bam.c:84:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[4]; data/samtools-legacy-0.1.19+dfsg/bam.c:125:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[4]; data/samtools-legacy-0.1.19+dfsg/bam.c:177:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&n, s + 1, 4); data/samtools-legacy-0.1.19+dfsg/bam.c:322:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&n, s, 4); data/samtools-legacy-0.1.19+dfsg/bam.c:462:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(cigar, new_cigar, l * 4); // set CIGAR data/samtools-legacy-0.1.19+dfsg/bam.h:295: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. extern unsigned char bam_nt16_table[256]; data/samtools-legacy-0.1.19+dfsg/bam.h:678:46: [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. uint8_t *bam_aux_get(const bam1_t *b, const char tag[2]); data/samtools-legacy-0.1.19+dfsg/bam.h:687:39: [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. void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data); data/samtools-legacy-0.1.19+dfsg/bam.h:688:45: [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. uint8_t *bam_aux_get_core(bam1_t *b, const char tag[2]); // an alias of bam_aux_get() data/samtools-legacy-0.1.19+dfsg/bam.h:748:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, bsrc->data, bsrc->data_len); // copy var-len data data/samtools-legacy-0.1.19+dfsg/bam.h:768:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(b->data, src->data, b->data_len); data/samtools-legacy-0.1.19+dfsg/bam2bcf.c:441:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(b->gi[0].data, bc->PL, b->gi[0].len * bc->n); data/samtools-legacy-0.1.19+dfsg/bam2bcf_indel.c:477:4: [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-legacy-0.1.19+dfsg/bam2depth.c:55:24: [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-legacy-0.1.19+dfsg/bam2depth.c:58:22: [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-legacy-0.1.19+dfsg/bam2depth.c:59:21: [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-legacy-0.1.19+dfsg/bam_aux.c:8:38: [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. void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data) data/samtools-legacy-0.1.19+dfsg/bam_aux.c:20:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(b->data + ori_len + 3, data, len); data/samtools-legacy-0.1.19+dfsg/bam_aux.c:23:44: [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. uint8_t *bam_aux_get_core(bam1_t *b, const char tag[2]) data/samtools-legacy-0.1.19+dfsg/bam_aux.c:36:45: [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. uint8_t *bam_aux_get(const bam1_t *b, const char tag[2]) data/samtools-legacy-0.1.19+dfsg/bam_aux.c:154:10: [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). *beg = atoi(s + name_end + 1); data/samtools-legacy-0.1.19+dfsg/bam_aux.c:156:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). *end = i < k? atoi(s + i + 1) : 1<<29; data/samtools-legacy-0.1.19+dfsg/bam_cat.c:126: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-legacy-0.1.19+dfsg/bam_cat.c:127: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-legacy-0.1.19+dfsg/bam_cat.c:131: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-legacy-0.1.19+dfsg/bam_import.c:24:10: [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 bam_nt16_table[256] = { data/samtools-legacy-0.1.19+dfsg/bam_import.c:136:9: [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). len = atoi(str->s); data/samtools-legacy-0.1.19+dfsg/bam_import.c:211:22: [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). h->target_len[i] = atoi(tmp[i]); data/samtools-legacy-0.1.19+dfsg/bam_import.c:259:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(alloc_data(b, doff + c->l_qname) + doff, str->s, c->l_qname); data/samtools-legacy-0.1.19+dfsg/bam_import.c:282:96: [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). ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->pos = isdigit(str->s[0])? atoi(str->s) - 1 : -1; data/samtools-legacy-0.1.19+dfsg/bam_import.c:283:97: [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). ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->qual = isdigit(str->s[0])? atoi(str->s) : 0; data/samtools-legacy-0.1.19+dfsg/bam_import.c:333: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). c->mpos = isdigit(str->s[0])? atoi(str->s) - 1 : -1; data/samtools-legacy-0.1.19+dfsg/bam_import.c:335:56: [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). c->isize = (str->s[0] == '-' || isdigit(str->s[0]))? atoi(str->s) : 0; data/samtools-legacy-0.1.19+dfsg/bam_import.c:435: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(s, str->s + 5, str->l - 5); data/samtools-legacy-0.1.19+dfsg/bam_import.c:449: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(s, &n, 4); s += 4; // write the number of elements data/samtools-legacy-0.1.19+dfsg/bam_index.c:329:2: [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 magic[4]; data/samtools-legacy-0.1.19+dfsg/bam_index.c:402:21: [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. strcpy(fnidx, fn); strcat(fnidx, ".bai"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:403:7: [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(fnidx, "rb"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:409:9: [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(fnidx, "rb"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:439:12: [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 = fopen(fn, "wb")) == 0) { data/samtools-legacy-0.1.19+dfsg/bam_index.c:464:3: [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(fnidx, fn), ".bai"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:492:22: [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. strcpy(fnidx, fn); strcat(fnidx, ".bai"); data/samtools-legacy-0.1.19+dfsg/bam_index.c:494: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). fpidx = fopen(fnidx, "wb"); data/samtools-legacy-0.1.19+dfsg/bam_lpileup.c:146:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(tv->pre_level, tv->cur_level, tv->n_cur * 4); data/samtools-legacy-0.1.19+dfsg/bam_md.c:249:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(bq, qual, c->l_qseq); data/samtools-legacy-0.1.19+dfsg/bam_md.c:331:22: [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-legacy-0.1.19+dfsg/bam_md.c:332: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). case 'C': capQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:16:2: [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-legacy-0.1.19+dfsg/bam_plcmd.c:277:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(bh->name, s.s, s.l); data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:284:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(bh->sname, s.s, s.l); data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:437: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-legacy-0.1.19+dfsg/bam_plcmd.c:445: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-legacy-0.1.19+dfsg/bam_plcmd.c:522: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 'd': mplp.max_depth = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:540: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 'C': mplp.capQ_thres = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:541: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 'M': mplp.max_mq = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:542: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 'q': mplp.min_mq = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:543: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': mplp.min_baseQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:545: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 'o': mplp.openQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:546: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). case 'e': mplp.extQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:547: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 'h': mplp.tandemQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:550: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 'm': mplp.min_support = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:551: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 'L': mplp.max_indel_depth = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:554: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-legacy-0.1.19+dfsg/bam_plcmd.c:556:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fp_rg = fopen(optarg, "r")) == 0) data/samtools-legacy-0.1.19+dfsg/bam_sort.c:218:18: [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(mode + 1, "%d", level < 9? level : 9); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:279:21: [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-legacy-0.1.19+dfsg/bam_sort.c:280: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). case '@': n_threads = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_sort.c:301: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). FILE *fp = fopen(argv[optind], "rb"); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:498:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char mode[8]; data/samtools-legacy-0.1.19+dfsg/bam_sort.c:500:19: [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(mode + 1, "%d", level < 9? level : 9); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:553: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). case '@': n_threads = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bam_sort.c:554:21: [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-legacy-0.1.19+dfsg/bam_tview.c:82: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. extern unsigned char bam_nt16_table[256]; data/samtools-legacy-0.1.19+dfsg/bam_tview_curses.c:102:2: [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-legacy-0.1.19+dfsg/bam_tview_html.c:323:14: [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-legacy-0.1.19+dfsg/bamshuf.c:52:2: [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 **fnt, modew[8]; data/samtools-legacy-0.1.19+dfsg/bamshuf.c:84:2: [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, "w%d", (clevel >= 0 && clevel <= 9)? clevel : DEF_CLEVEL); data/samtools-legacy-0.1.19+dfsg/bamshuf.c:123: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_files = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bamshuf.c:124:22: [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-legacy-0.1.19+dfsg/bcftools/bcf.c:98:2: [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 *p, *tmp[5]; data/samtools-legacy-0.1.19+dfsg/bcftools/bcf.c:318:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(b->str + shift - 1, info, l); // append to the INFO field data/samtools-legacy-0.1.19+dfsg/bcftools/bcf.c:381:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(r->str, b->str, r->m_str); data/samtools-legacy-0.1.19+dfsg/bcftools/bcf.c:384:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(r->gi[i].data, b->gi[i].data, r->n_smpl * r->gi[i].len); data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:279:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(swap, PLi, gi->len); data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:372:4: [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(swap + gi->len * a[i], data + gi->len * i, gi->len); data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:409:29: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. h->name = malloc(h->l_nm); memcpy(h->name, h0->name, h->l_nm); data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:410:36: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. h->txt = calloc(1, h->l_txt + 1); memcpy(h->txt, h0->txt, h->l_txt); data/samtools-legacy-0.1.19+dfsg/bcftools/bcfutils.c:424:4: [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(swap + i * gi->len, (uint8_t*)gi->data + list[i] * gi->len, gi->len); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:70:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(a->d, anno, 4 * sizeof(int)); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:204: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(sam[n], p, t-p); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:341:2: [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 moder[4], modew[4]; data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:349:21: [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': vc.n1 = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:373: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). case 'U': vc.n_perm = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/bcftools/em.c:220:27: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. for (i = 0; i < 3; ++i) memcpy(g[i], x + 1, 3 * sizeof(double)); data/samtools-legacy-0.1.19+dfsg/bcftools/em.c:290:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(flast, f, 4 * sizeof(double)); data/samtools-legacy-0.1.19+dfsg/bcftools/fet.c:101:2: [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 id[1024]; data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:128:2: [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 magic[4]; data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:188:12: [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 = fopen(fn, "w")) == 0) { data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:211:2: [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(fnidx, fn), ".bci"); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:256:22: [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. strcpy(fnidx, fn); strcat(fnidx, ".bci"); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:302:11: [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). *begin = atoi(p); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:305:10: [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). *end = atoi(p); data/samtools-legacy-0.1.19+dfsg/bcftools/kmin.c:80:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(x1, x, n * sizeof(double)); /* x1 = x */ data/samtools-legacy-0.1.19+dfsg/bcftools/main.c:89: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). else if (k == 1) pos0 = atoi(q) - 1; data/samtools-legacy-0.1.19+dfsg/bcftools/main.c:91: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). else if (k == 3) pos1 = atoi(q) - 1; data/samtools-legacy-0.1.19+dfsg/bcftools/main.c:96:22: [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). if (k == 3) pos1 = atoi(q) - 1; data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.c:21:10: [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 seq_nt4_table[256] = { data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.c:144:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ma->ploidy, ploidy, n); data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.c:710: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(ma->z1, z[1], sizeof(double) * (ma->n1 * 2 + 1)); data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.c:756: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. if (z[0] != ma->z) memcpy(ma->z, z[0], sizeof(double) * (ma->M + 1)); data/samtools-legacy-0.1.19+dfsg/bcftools/prob1.c:771:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ma->z2, ma->z, sizeof(double) * (2 * (ma->n - ma->n1) + 1)); data/samtools-legacy-0.1.19+dfsg/bcftools/vcf.c:76: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). v->fpout = strcmp(fn, "-")? fopen(fn, "w") : stdout; data/samtools-legacy-0.1.19+dfsg/bcftools/vcf.c:178:13: [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). b->pos = atoi(p) - 1; data/samtools-legacy-0.1.19+dfsg/bedcov.c:43:24: [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-legacy-0.1.19+dfsg/bedcov.c:84:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). *p = 0; beg = atoi(q); *p = '\t'; data/samtools-legacy-0.1.19+dfsg/bedcov.c:88:18: [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). *p = 0; end = atoi(q); *p = c; data/samtools-legacy-0.1.19+dfsg/bedidx.c:124:11: [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). beg = atoi(str->s); // begin data/samtools-legacy-0.1.19+dfsg/bedidx.c:127:13: [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). end = atoi(str->s); // end data/samtools-legacy-0.1.19+dfsg/bgzf.c:54: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). #define _bgzf_open(fn, mode) fopen(fn, mode) data/samtools-legacy-0.1.19+dfsg/bgzf.c:150: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). if ((fpw = fopen(path, "w")) == 0) return 0; data/samtools-legacy-0.1.19+dfsg/bgzf.c:192:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, g_magic, BLOCK_HEADER_LENGTH); // the last two bytes are a place holder for the length of the block data/samtools-legacy-0.1.19+dfsg/bgzf.c:270:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(fp->uncompressed_block, p->block, BGZF_MAX_BLOCK_SIZE); data/samtools-legacy-0.1.19+dfsg/bgzf.c:299:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(kh_val(h, k).block, fp->uncompressed_block, BGZF_MAX_BLOCK_SIZE); data/samtools-legacy-0.1.19+dfsg/bgzf.c:326:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(compressed_block, header, BLOCK_HEADER_LENGTH); data/samtools-legacy-0.1.19+dfsg/bgzf.c:358:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(output, buffer + fp->block_offset, copy_length); data/samtools-legacy-0.1.19+dfsg/bgzf.c:406:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(w->mt->blk[i], w->buf, clen); data/samtools-legacy-0.1.19+dfsg/bgzf.c:472:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(mt->blk[mt->curr], fp->uncompressed_block, fp->block_offset); data/samtools-legacy-0.1.19+dfsg/bgzf.c:517:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(fp->uncompressed_block + fp->block_offset, input, copy_length); data/samtools-legacy-0.1.19+dfsg/bgzf.c:561:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer + fp->block_offset, input, copy_length); data/samtools-legacy-0.1.19+dfsg/bgzf.c:682:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(str->s + str->l, buf + fp->block_offset, l); data/samtools-legacy-0.1.19+dfsg/bgzip.c:55:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0666)) < 0 && errno == EEXIST) { data/samtools-legacy-0.1.19+dfsg/bgzip.c:65:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { data/samtools-legacy-0.1.19+dfsg/bgzip.c:92:21: [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 'b': start = atol(optarg); break; data/samtools-legacy-0.1.19+dfsg/bgzip.c:93:20: [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': size = atol(optarg); break; data/samtools-legacy-0.1.19+dfsg/bgzip.c:115:17: [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 ((f_src = open(argv[optind], O_RDONLY)) < 0) { data/samtools-legacy-0.1.19+dfsg/bgzip.c:126: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(name, ".gz"); data/samtools-legacy-0.1.19+dfsg/cut_target.c:147: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 'Q': g.min_baseQ = atoi(optarg); break; // quality cutoff data/samtools-legacy-0.1.19+dfsg/cut_target.c:148: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 'i': g_param.p[0][1] = -atoi(optarg); break; // 0->1 transition (in) PENALTY data/samtools-legacy-0.1.19+dfsg/cut_target.c:149: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 '0': g_param.e[1][0] = atoi(optarg); break; // emission SCORE data/samtools-legacy-0.1.19+dfsg/cut_target.c:150: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 '1': g_param.e[1][1] = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/cut_target.c:151: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 '2': g_param.e[1][2] = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/faidx.c:28:29: [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). #define razf_open(fn, mode) fopen(fn, mode) data/samtools-legacy-0.1.19+dfsg/faidx.c:204:7: [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(str, "wb"); data/samtools-legacy-0.1.19+dfsg/faidx.c:232: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-legacy-0.1.19+dfsg/faidx.c:242: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). if ((fp = fopen(fn, "wb")) == 0) { data/samtools-legacy-0.1.19+dfsg/faidx.c:254:12: [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). return fopen(fn, "r"); data/samtools-legacy-0.1.19+dfsg/faidx.c:279: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). fp = fopen(str, "rb"); data/samtools-legacy-0.1.19+dfsg/faidx.c:283:8: [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(str, "rb"); data/samtools-legacy-0.1.19+dfsg/faidx.c:351:9: [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). beg = atoi(s + name_end + 1); data/samtools-legacy-0.1.19+dfsg/faidx.c:353:16: [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). end = i < k? atoi(s + i + 1) : val.len; data/samtools-legacy-0.1.19+dfsg/knetfile.c:175: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). server.sin_port = htons(atoi(port)); data/samtools-legacy-0.1.19+dfsg/knetfile.c:249:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ftp->pasv_ip, v, 4 * sizeof(int)); data/samtools-legacy-0.1.19+dfsg/knetfile.c:257:2: [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 host[80], port[10]; data/samtools-legacy-0.1.19+dfsg/knetfile.c:262:2: [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(host, "%d.%d.%d.%d", ftp->pasv_ip[0], ftp->pasv_ip[1], ftp->pasv_ip[2], ftp->pasv_ip[3]); data/samtools-legacy-0.1.19+dfsg/knetfile.c:263:2: [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(port, "%d", ftp->pasv_port); data/samtools-legacy-0.1.19+dfsg/knetfile.c:342:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[32]; data/samtools-legacy-0.1.19+dfsg/knetfile.c:344:3: [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(tmp, "REST %lld\r\n", (long long)fp->offset); data/samtools-legacy-0.1.19+dfsg/knetfile.c:346:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(tmp, "REST "); data/samtools-legacy-0.1.19+dfsg/knetfile.c:348:3: [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(tmp, "\r\n"); data/samtools-legacy-0.1.19+dfsg/knetfile.c:413:10: [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. l += sprintf(buf + l, "Range: bytes=%lld-\r\n", (long long)fp->offset); data/samtools-legacy-0.1.19+dfsg/knetfile.c:414:7: [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. l += sprintf(buf + l, "\r\n"); data/samtools-legacy-0.1.19+dfsg/knetfile.c:475:12: [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(fn, O_RDONLY | O_BINARY); data/samtools-legacy-0.1.19+dfsg/knetfile.c:477:12: [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(fn, O_RDONLY); data/samtools-legacy-0.1.19+dfsg/kprobaln.c:257:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). case 'b': b = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/kprobaln.c:258:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). case 'q': q = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/kseq.h:125:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \ data/samtools-legacy-0.1.19+dfsg/kstring.h:87:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(s->s + s->l, p, l); data/samtools-legacy-0.1.19+dfsg/kstring.h:112:2: [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-legacy-0.1.19+dfsg/kstring.h:130:2: [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-legacy-0.1.19+dfsg/kstring.h:147:2: [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[32]; data/samtools-legacy-0.1.19+dfsg/misc/ace2sam.c:155:10: [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-legacy-0.1.19+dfsg/misc/ace2sam.c:172: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). ks_getuntil(ks, 0, &s, &dret); pos = atoi(s.s); neg = pos < 0? 1 : 0; pos = pos < 0? -pos : pos; // position data/samtools-legacy-0.1.19+dfsg/misc/ace2sam.c:188: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). ks_getuntil(ks, 0, &s, &dret); beg = atoi(s.s) - 1; // align clipping start data/samtools-legacy-0.1.19+dfsg/misc/ace2sam.c:189: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). ks_getuntil(ks, 0, &s, &dret); end = atoi(s.s); // clipping end data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:602: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-legacy-0.1.19+dfsg/misc/bamcheck.c:604: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-legacy-0.1.19+dfsg/misc/bamcheck.c:1162: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-legacy-0.1.19+dfsg/misc/bamcheck.c:1336: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]; data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1360: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(in_mode, "rb"); data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1404:47: [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': stats->filter_readlen = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1405: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 'i': stats->nisize = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1407: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 'q': stats->trim_qual = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/maq2sam.c:37:2: [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-legacy-0.1.19+dfsg/misc/md5.c:88:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(p, buf, len); data/samtools-legacy-0.1.19+dfsg/misc/md5.c:91:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(p, buf, t); data/samtools-legacy-0.1.19+dfsg/misc/md5.c:100:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ctx->in, buf, 64); data/samtools-legacy-0.1.19+dfsg/misc/md5.c:109: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(ctx->in, buf, len); data/samtools-legacy-0.1.19+dfsg/misc/md5.c:117: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]; struct MD5Context *ctx; data/samtools-legacy-0.1.19+dfsg/misc/md5.c:154: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(digest, ctx->buf, 16); data/samtools-legacy-0.1.19+dfsg/misc/md5.c:270:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[4096], digest[16]; data/samtools-legacy-0.1.19+dfsg/misc/md5.c:275:24: [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-legacy-0.1.19+dfsg/misc/md5.h:41: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 in[64]; data/samtools-legacy-0.1.19+dfsg/misc/md5.h:46:24: [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. void MD5Final(unsigned char digest[16], struct MD5Context *ctx); data/samtools-legacy-0.1.19+dfsg/misc/md5fa.c:16:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char unordered[16], digest[16]; data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:394: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). case 'd': dist = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:395: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 's': std_dev = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:396:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). case 'N': N = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:397:22: [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-legacy-0.1.19+dfsg/misc/wgsim.c:398:22: [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-legacy-0.1.19+dfsg/misc/wgsim.c:403: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). case 'S': seed = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/misc/wgsim.c:408:11: [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-legacy-0.1.19+dfsg/misc/wgsim.c:409:11: [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-legacy-0.1.19+dfsg/padding.c:22:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(b->data + b->core.l_qname, cigar, n * 4); data/samtools-legacy-0.1.19+dfsg/padding.c:25: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. } else memcpy(b->data + b->core.l_qname, cigar, n * 4); data/samtools-legacy-0.1.19+dfsg/padding.c:384:2: [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[5], *fn_out = 0, *fn_list = 0, *fn_ref = 0; data/samtools-legacy-0.1.19+dfsg/padding.c:407:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[2]; data/samtools-legacy-0.1.19+dfsg/phase.c:481: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). uint64_t x = (uint64_t)tid<<32 | (atoi(str->s) - 1); data/samtools-legacy-0.1.19+dfsg/phase.c:528: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 'D': g.max_depth = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/phase.c:529: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 'q': g.min_varLOD = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/phase.c:530: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 'Q': g.min_baseQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/phase.c:531: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). case 'k': g.k = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/phase.c:563:21: [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. strcpy(s, g.pre); strcat(s, ".0.bam"); g.out[0] = bam_open(s, "w"); data/samtools-legacy-0.1.19+dfsg/phase.c:564:21: [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. strcpy(s, g.pre); strcat(s, ".1.bam"); g.out[1] = bam_open(s, "w"); data/samtools-legacy-0.1.19+dfsg/phase.c:565:21: [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. strcpy(s, g.pre); strcat(s, ".chimera.bam"); g.out[2] = bam_open(s, "w"); data/samtools-legacy-0.1.19+dfsg/razf.c:382:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(rz->outbuf, rz->inbuf, n); data/samtools-legacy-0.1.19+dfsg/razf.c:506:8: [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). fd = open(filename, O_RDONLY | O_BINARY); data/samtools-legacy-0.1.19+dfsg/razf.c:508:8: [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). fd = open(filename, O_RDONLY); data/samtools-legacy-0.1.19+dfsg/razf.c:515:8: [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). fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); data/samtools-legacy-0.1.19+dfsg/razf.c:517:8: [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). fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); data/samtools-legacy-0.1.19+dfsg/razip.c:30:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0666)) < 0 && errno == EEXIST) { data/samtools-legacy-0.1.19+dfsg/razip.c:40:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { data/samtools-legacy-0.1.19+dfsg/razip.c:62:21: [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 'b': start = atol(optarg); break; data/samtools-legacy-0.1.19+dfsg/razip.c:63:20: [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': size = atol(optarg); break; data/samtools-legacy-0.1.19+dfsg/razip.c:75:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if((f_src = open(argv[optind], O_RDONLY)) < 0){ data/samtools-legacy-0.1.19+dfsg/razip.c:84: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(name, ".rz"); data/samtools-legacy-0.1.19+dfsg/sam.c:17:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(h->text, h0->text, h->l_text); data/samtools-legacy-0.1.19+dfsg/sam.c:76:4: [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 bmode[3]; data/samtools-legacy-0.1.19+dfsg/sam.c:88:34: [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->x.tamw = strcmp(fn, "-")? fopen(fn, "w") : stdout; data/samtools-legacy-0.1.19+dfsg/sam.c:173:2: [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-legacy-0.1.19+dfsg/sam_header.c:22: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 key[2]; data/samtools-legacy-0.1.19+dfsg/sam_header.c:29: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 type[2]; data/samtools-legacy-0.1.19+dfsg/sam_header.c:175: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(*lineptr,text,len); data/samtools-legacy-0.1.19+dfsg/sam_header.c:191: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(tag->value,value_from,len+1); data/samtools-legacy-0.1.19+dfsg/sam_header.c:547:17: [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. nout += sprintf(out+nout,"@%c%c",hline->type[0],hline->type[1]); data/samtools-legacy-0.1.19+dfsg/sam_header.c:555:25: [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. nout += sprintf(out+nout,"%c%c:", tag->key[0],tag->key[1]); data/samtools-legacy-0.1.19+dfsg/sam_header.c:598:41: [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. void *sam_header2tbl(const void *_dict, char type[2], char key_tag[2], char value_tag[2]) data/samtools-legacy-0.1.19+dfsg/sam_header.c:598:55: [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. void *sam_header2tbl(const void *_dict, char type[2], char key_tag[2], char value_tag[2]) data/samtools-legacy-0.1.19+dfsg/sam_header.c:598:72: [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. void *sam_header2tbl(const void *_dict, char type[2], char key_tag[2], char value_tag[2]) data/samtools-legacy-0.1.19+dfsg/sam_header.c:636:1: [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 **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n) data/samtools-legacy-0.1.19+dfsg/sam_header.c:636:43: [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 **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n) data/samtools-legacy-0.1.19+dfsg/sam_header.c:636:57: [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 **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n) data/samtools-legacy-0.1.19+dfsg/sam_header.c:673:44: [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. void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **_key, const char **_value) data/samtools-legacy-0.1.19+dfsg/sam_header.c:673:64: [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. void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **_key, const char **_value) data/samtools-legacy-0.1.19+dfsg/sam_header.c:673:87: [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. void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **_key, const char **_value) data/samtools-legacy-0.1.19+dfsg/sam_header.c:773:1: [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 **sam_header2tbl_n(const void *dict, const char type[2], const char *tags[], int *n) data/samtools-legacy-0.1.19+dfsg/sam_header.c:773:49: [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 **sam_header2tbl_n(const void *dict, const char type[2], const char *tags[], int *n) data/samtools-legacy-0.1.19+dfsg/sam_header.h:19:48: [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. void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **key, const char **value); data/samtools-legacy-0.1.19+dfsg/sam_header.h:19:68: [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. void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **key, const char **value); data/samtools-legacy-0.1.19+dfsg/sam_header.h:19:91: [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. void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **key, const char **value); data/samtools-legacy-0.1.19+dfsg/sam_header.h:20:2: [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 **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n); data/samtools-legacy-0.1.19+dfsg/sam_header.h:20:44: [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 **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n); data/samtools-legacy-0.1.19+dfsg/sam_header.h:20:58: [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 **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n); data/samtools-legacy-0.1.19+dfsg/sam_header.h:37: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 **sam_header2tbl_n(const void *dict, const char type[2], const char *tags[], int *n); data/samtools-legacy-0.1.19+dfsg/sam_header.h:37:53: [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 **sam_header2tbl_n(const void *dict, const char type[2], const char *tags[], int *n); data/samtools-legacy-0.1.19+dfsg/sam_header.h:39:41: [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. void *sam_header2tbl(const void *dict, char type[2], char key_tag[2], char value_tag[2]); data/samtools-legacy-0.1.19+dfsg/sam_header.h:39:55: [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. void *sam_header2tbl(const void *dict, char type[2], char key_tag[2], char value_tag[2]); data/samtools-legacy-0.1.19+dfsg/sam_header.h:39:72: [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. void *sam_header2tbl(const void *dict, char type[2], char key_tag[2], char value_tag[2]); data/samtools-legacy-0.1.19+dfsg/sam_view.c:134:2: [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[5], *fn_out = 0, *fn_list = 0, *fn_ref = 0, *fn_rg = 0, *q; data/samtools-legacy-0.1.19+dfsg/sam_view.c:147: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 'm': g_min_qlen = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/sam_view.c:157: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 'q': g_min_mapQ = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/sam_view.c:169: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 'Q': g_qual_scale = atoi(optarg); break; data/samtools-legacy-0.1.19+dfsg/sam_view.c:184:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[2]; data/samtools-legacy-0.1.19+dfsg/sam_view.c:193:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/samtools-legacy-0.1.19+dfsg/sam_view.c:196:11: [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_rg = fopen(fn_rg, "r"); data/samtools-legacy-0.1.19+dfsg/bam.c:128:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buf, "BAM\001", 4); data/samtools-legacy-0.1.19+dfsg/bam.c:145:14: [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_len = strlen(p) + 1; data/samtools-legacy-0.1.19+dfsg/bam_aux.c:118: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). name_end = l = strlen(str); data/samtools-legacy-0.1.19+dfsg/bam_color.c:23:10: [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-legacy-0.1.19+dfsg/bam_color.c:52:10: [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-legacy-0.1.19+dfsg/bam_color.c:113:10: [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-legacy-0.1.19+dfsg/bam_import.c:189:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(header->text + header->l_text, str->s, str->l+1); // we cannot use strcpy() here. data/samtools-legacy-0.1.19+dfsg/bam_import.c:258: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). c->l_qname = strlen(str->s) + 1; data/samtools-legacy-0.1.19+dfsg/bam_import.c:344: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). c->l_qseq = strlen(str->s); data/samtools-legacy-0.1.19+dfsg/bam_import.c:357:43: [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 (strcmp(str->s, "*") && c->l_qseq != strlen(str->s)) data/samtools-legacy-0.1.19+dfsg/bam_index.c:396:11: [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); data/samtools-legacy-0.1.19+dfsg/bam_index.c:401: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). fnidx = (char*)calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/bam_index.c:406: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 (s == fn + strlen(fn) - 3) { data/samtools-legacy-0.1.19+dfsg/bam_index.c:408:10: [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). fnidx[strlen(fn)-1] = 'i'; data/samtools-legacy-0.1.19+dfsg/bam_index.c:430:6: [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(url); data/samtools-legacy-0.1.19+dfsg/bam_index.c:463: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). char *fnidx = calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/bam_index.c:491: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). fnidx = (char*)calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/bam_md.c:106:8: [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-legacy-0.1.19+dfsg/bam_md.c:319:2: [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_r, "r"); strcpy(mode_w, "w"); data/samtools-legacy-0.1.19+dfsg/bam_md.c:319:23: [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_r, "r"); strcpy(mode_w, "w"); data/samtools-legacy-0.1.19+dfsg/bam_md.c:338:18: [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_sam_in) strcat(mode_r, "b"); data/samtools-legacy-0.1.19+dfsg/bam_md.c:339:18: [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-legacy-0.1.19+dfsg/bam_md.c:340:7: [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-legacy-0.1.19+dfsg/bam_md.c:341:23: [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, "u"); data/samtools-legacy-0.1.19+dfsg/bam_plcmd.c:457: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-legacy-0.1.19+dfsg/bam_sort.c:123:12: [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-legacy-0.1.19+dfsg/bam_sort.c:130:4: [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-legacy-0.1.19+dfsg/bam_sort.c:217:2: [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"); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:340: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). h->l_text += strlen(so) + 15; data/samtools-legacy-0.1.19+dfsg/bam_sort.c:345: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). h->l_text = (beg - h->text) + (4 + strlen(so)) + (h->text + h->l_text - end); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:347:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(newtext, h->text, beg - h->text); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:391: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). name = (char*)calloc(strlen(w->prefix) + 20, 1); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:493: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). fnout = calloc(strlen(prefix) + 20, 1); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:494:17: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. if (is_stdout) sprintf(fnout, "-"); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:499:3: [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"); data/samtools-legacy-0.1.19+dfsg/bam_sort.c:509:27: [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-legacy-0.1.19+dfsg/bam_tview.c:257: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). str = (char*)calloc(strlen(tv->header->target_name[tv->curr_tid]) + 30, 1); data/samtools-legacy-0.1.19+dfsg/bamshuf.c:65:6: [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-legacy-0.1.19+dfsg/bcftools/bcf.c:329:33: [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_diff = 0, ori_len = strlen(str); data/samtools-legacy-0.1.19+dfsg/bcftools/bcf.c:391:6: [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(b->ref) > 1) return 1; data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:380:73: [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). for (tid = 0; tid < vc.n_sub; ++tid) vc.ploidy[tid] = vc.subsam[tid][strlen(vc.subsam[tid]) + 1]; data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:452:2: [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(moder, "r"); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:453:29: [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 (!(vc.flag & VC_VCFIN)) strcat(moder, "b"); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:454:2: [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(modew, "w"); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:455:27: [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 (vc.flag & VC_BCFOUT) strcat(modew, "b"); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:456:27: [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 (vc.flag & VC_UNCOMP) strcat(modew, "u"); data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:526:72: [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 (vc.bed && !bed_overlap(vc.bed, hin->ns[b->tid], b->pos, b->pos + strlen(b->ref))) continue; data/samtools-legacy-0.1.19+dfsg/bcftools/call1.c:528:12: [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(b->ref); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:75: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). tmp = strlen(b->ref); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:179:6: [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(url); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:210:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *fnidx = (char*)calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:214:11: [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(fnidx); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:255: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). fnidx = (char*)calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/bcftools/index.c:285:6: [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(str); data/samtools-legacy-0.1.19+dfsg/bgzip.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). char *name = malloc(strlen(argv[optind]) + 5); data/samtools-legacy-0.1.19+dfsg/bgzip.c:137:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = read(f_src, buffer, WINDOW_SIZE)) > 0) data/samtools-legacy-0.1.19+dfsg/bgzip.c:157:14: [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(argv[optind]); data/samtools-legacy-0.1.19+dfsg/bgzip.c:174:10: [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[strlen(name) - 3] = '\0'; data/samtools-legacy-0.1.19+dfsg/faidx.c:194: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). str = (char*)calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/faidx.c:226: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 l = strlen(fn); data/samtools-legacy-0.1.19+dfsg/faidx.c:263: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). str = (char*)calloc(strlen(fn) + 5, 1); data/samtools-legacy-0.1.19+dfsg/faidx.c:314: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). name_end = l = strlen(str); data/samtools-legacy-0.1.19+dfsg/knetfile.c:236:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). netwrite(ftp->ctrl_fd, cmd, strlen(cmd)); data/samtools-legacy-0.1.19+dfsg/knetfile.c:309:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fp->host, fn + 6, l); data/samtools-legacy-0.1.19+dfsg/knetfile.c:310: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). fp->retr = calloc(strlen(p) + 8, 1); data/samtools-legacy-0.1.19+dfsg/knetfile.c:312:27: [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). fp->size_cmd = calloc(strlen(p) + 8, 1); data/samtools-legacy-0.1.19+dfsg/knetfile.c:381:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fp->http_host, fn + 7, l); data/samtools-legacy-0.1.19+dfsg/knetfile.c:520:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). curr = read(fp->fd, buf + l, rest); data/samtools-legacy-0.1.19+dfsg/knetfile.h:8:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define netread(fd, ptr, len) read(fd, ptr, len) data/samtools-legacy-0.1.19+dfsg/kprobaln.c:269:10: [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_ref = strlen((char*)ref); l_query = strlen((char*)query); data/samtools-legacy-0.1.19+dfsg/kprobaln.c:269:40: [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_ref = strlen((char*)ref); l_query = strlen((char*)query); data/samtools-legacy-0.1.19+dfsg/kstring.c:58:6: [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(s); data/samtools-legacy-0.1.19+dfsg/kstring.c:161: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). return (char*)kmemmem(str, strlen(str), pat, strlen(pat), _prep); data/samtools-legacy-0.1.19+dfsg/kstring.c:161:47: [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). return (char*)kmemmem(str, strlen(str), pat, strlen(pat), _prep); data/samtools-legacy-0.1.19+dfsg/kstring.c:166: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). return (char*)kmemmem(str, n, pat, strlen(pat), _prep); data/samtools-legacy-0.1.19+dfsg/kstring.h:95:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return kputsn(p, strlen(p), s); data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:382:39: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). uint8_t cread = bam1_seqi(read,iread); data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1135:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c=getc(fp))!= EOF && c!='\n') data/samtools-legacy-0.1.19+dfsg/misc/bamcheck.c:1388:23: [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. case 's': strcpy(in_mode, "r"); break; data/samtools-legacy-0.1.19+dfsg/misc/maq2sam.c:117:12: [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-legacy-0.1.19+dfsg/padding.c:338: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). assert(strlen(old->text) == strlen(header->text)); data/samtools-legacy-0.1.19+dfsg/padding.c:338:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). assert(strlen(old->text) == strlen(header->text)); data/samtools-legacy-0.1.19+dfsg/padding.c:356:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(newtext, text, end - text + 1); data/samtools-legacy-0.1.19+dfsg/padding.c:362:10: [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). assert (strlen(header->text) <= strlen(old->text)); data/samtools-legacy-0.1.19+dfsg/padding.c:362: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). assert (strlen(header->text) <= strlen(old->text)); data/samtools-legacy-0.1.19+dfsg/padding.c:363:6: [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(header->text) < header->l_text) { data/samtools-legacy-0.1.19+dfsg/padding.c:366: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). newtext = malloc(strlen(header->text) + 1); data/samtools-legacy-0.1.19+dfsg/padding.c:370: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). header->l_text = strlen(newtext); data/samtools-legacy-0.1.19+dfsg/padding.c:388:2: [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-legacy-0.1.19+dfsg/padding.c:388:24: [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-legacy-0.1.19+dfsg/padding.c:403:16: [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_bamin) strcat(in_mode, "b"); data/samtools-legacy-0.1.19+dfsg/padding.c:404:17: [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_bamout) strcat(out_mode, "b"); data/samtools-legacy-0.1.19+dfsg/padding.c:405:2: [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-legacy-0.1.19+dfsg/phase.c:562: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). char *s = malloc(strlen(g.pre) + 20); data/samtools-legacy-0.1.19+dfsg/razf.c:124:2: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, &rz->index->size, sizeof(int)); data/samtools-legacy-0.1.19+dfsg/razf.c:133:2: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, rz->index->bin_offsets, sizeof(int64_t) * v32); data/samtools-legacy-0.1.19+dfsg/razf.c:139:2: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, rz->index->cell_offsets, sizeof(int) * rz->index->size); data/samtools-legacy-0.1.19+dfsg/razf.c:178:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy((char*)rz->header->extra, "RAZF", 4); data/samtools-legacy-0.1.19+dfsg/razf.c:375:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(rz->filedes, rz->inbuf, RZ_BUFFER_SIZE); data/samtools-legacy-0.1.19+dfsg/razf.c:422:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, &end, sizeof(int64_t)); data/samtools-legacy-0.1.19+dfsg/razf.c:430:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, &end, sizeof(int64_t)); data/samtools-legacy-0.1.19+dfsg/razf.c:572:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(rz->filedes, data, size); data/samtools-legacy-0.1.19+dfsg/razf.c:586:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rz->stream->avail_in = read(rz->filedes, rz->inbuf, rz->end -rz->in); data/samtools-legacy-0.1.19+dfsg/razf.c:592:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rz->stream->avail_in = read(rz->filedes, rz->inbuf, RZ_BUFFER_SIZE); data/samtools-legacy-0.1.19+dfsg/razip.c:82: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). char *name = malloc(sizeof(strlen(argv[optind]) + 5)); data/samtools-legacy-0.1.19+dfsg/razip.c:95:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((c = read(f_src, buffer, WINDOW_SIZE)) > 0) razf_write(rz, buffer, c); data/samtools-legacy-0.1.19+dfsg/razip.c:114:55: [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 (strstr(argv[optind], ".rz") - argv[optind] != strlen(argv[optind]) - 3) { data/samtools-legacy-0.1.19+dfsg/razip.c:119:10: [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[strlen(name) - 3] = '\0'; data/samtools-legacy-0.1.19+dfsg/sam.c:34:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(header->text + header->l_text, text, len); // we cannot use strcpy() here. data/samtools-legacy-0.1.19+dfsg/sam.c:145:11: [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(s); data/samtools-legacy-0.1.19+dfsg/sam.c:172:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). fn_list = calloc(strlen(fn_ref) + 5, 1); data/samtools-legacy-0.1.19+dfsg/sam_header.c:532: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). len += strlen(tag->value) + 1; // \t data/samtools-legacy-0.1.19+dfsg/sam_header.c:534: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). len += strlen(tag->value) + 3; // XY: data/samtools-legacy-0.1.19+dfsg/sam_header.c:553:21: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. nout += sprintf(out+nout,"\t"); data/samtools-legacy-0.1.19+dfsg/sam_header.c:560:17: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. nout += sprintf(out+nout,"\n"); data/samtools-legacy-0.1.19+dfsg/sam_view.c:86: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). if (q == 0) q = p + strlen(p); data/samtools-legacy-0.1.19+dfsg/sam_view.c:137:2: [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-legacy-0.1.19+dfsg/sam_view.c:137:24: [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-legacy-0.1.19+dfsg/sam_view.c:176:17: [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_bamout) strcat(out_mode, "b"); data/samtools-legacy-0.1.19+dfsg/sam_view.c:178:29: [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 (of_type == BAM_OFHEX) strcat(out_mode, "x"); data/samtools-legacy-0.1.19+dfsg/sam_view.c:179:34: [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 (of_type == BAM_OFSTR) strcat(out_mode, "X"); data/samtools-legacy-0.1.19+dfsg/sam_view.c:181:16: [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_bamin) strcat(in_mode, "b"); data/samtools-legacy-0.1.19+dfsg/sam_view.c:182:17: [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_header) strcat(out_mode, "h"); ANALYSIS SUMMARY: Hits = 488 Lines analyzed = 25411 in approximately 0.95 seconds (26881 lines/second) Physical Source Lines of Code (SLOC) = 20896 Hits@level = [0] 747 [1] 123 [2] 264 [3] 56 [4] 45 [5] 0 Hits@level+ = [0+] 1235 [1+] 488 [2+] 365 [3+] 101 [4+] 45 [5+] 0 Hits/KSLOC@level+ = [0+] 59.1022 [1+] 23.3538 [2+] 17.4675 [3+] 4.83346 [4+] 2.15352 [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.