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/python-pairix-0.3.7/src/bam_endian.h Examining data/python-pairix-0.3.7/src/bedidx.c Examining data/python-pairix-0.3.7/src/bgzf.c Examining data/python-pairix-0.3.7/src/bgzf.h Examining data/python-pairix-0.3.7/src/bgzip.c Examining data/python-pairix-0.3.7/src/index.c Examining data/python-pairix-0.3.7/src/khash.h Examining data/python-pairix-0.3.7/src/knetfile.c Examining data/python-pairix-0.3.7/src/knetfile.h Examining data/python-pairix-0.3.7/src/kseq.h Examining data/python-pairix-0.3.7/src/ksort.h Examining data/python-pairix-0.3.7/src/kstring.c Examining data/python-pairix-0.3.7/src/kstring.h Examining data/python-pairix-0.3.7/src/main.c Examining data/python-pairix-0.3.7/src/pairix.h Examining data/python-pairix-0.3.7/src/pairixmodule.c Examining data/python-pairix-0.3.7/src/pairs_merger.c Examining data/python-pairix-0.3.7/src/streamer_1d.c FINAL RESULTS: data/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/index.c:275:19: [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(sname_double,x.ss); data/python-pairix-0.3.7/src/index.c:279:19: [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(str_ptr,x.ss2); data/python-pairix-0.3.7/src/index.c:730: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), ".px2"); data/python-pairix-0.3.7/src/index.c:787: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, ".px2"); data/python-pairix-0.3.7/src/index.c:889:11: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(s+i+1, s); data/python-pairix-0.3.7/src/index.c:905:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(sname, s + coord1s); data/python-pairix-0.3.7/src/index.c:908:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(sname+h+1, s+coord2s); data/python-pairix-0.3.7/src/index.c:1226:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(regions[i], chr1list[i]); data/python-pairix-0.3.7/src/index.c:1229:13: [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(regions[i], chr2); data/python-pairix-0.3.7/src/index.c:1254:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(regions[i], chr1); data/python-pairix-0.3.7/src/index.c:1257:13: [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(regions[i], chr2list[i]); data/python-pairix-0.3.7/src/index.c:1361:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(namepair,name); data/python-pairix-0.3.7/src/index.c:1365:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(str_ptr,name2); data/python-pairix-0.3.7/src/index.c:1411:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(namepair,name); data/python-pairix-0.3.7/src/index.c:1415:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(str_ptr,name2); data/python-pairix-0.3.7/src/index.c:1624:14: [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), ".px2"); data/python-pairix-0.3.7/src/index.c:1697: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). strcpy(sublist[k], b_split+1); data/python-pairix-0.3.7/src/index.c:1732: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). strcpy(sublist[k], seqpair_list[i]); data/python-pairix-0.3.7/src/index.c:1751: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(s_flp, s + i + 1); data/python-pairix-0.3.7/src/index.c:1753: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(s_flp + l2 + 1, s); data/python-pairix-0.3.7/src/index.c:1840:11: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(seq1_list[i], seqpair); data/python-pairix-0.3.7/src/index.c:1881:7: [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(uniq_seq_list[0],seq_list[0]); data/python-pairix-0.3.7/src/index.c:1887:11: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(uniq_seq_list[k],seq_list[i]); data/python-pairix-0.3.7/src/knetfile.c:314: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/python-pairix-0.3.7/src/knetfile.c:316: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/python-pairix-0.3.7/src/knetfile.c:415: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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/main.c:16:22: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define error(...) { fprintf(stderr,__VA_ARGS__); return -1; } data/python-pairix-0.3.7/src/main.c:298:12: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcpy(fnidx, argv[optind]), ".px2"); data/python-pairix-0.3.7/src/pairixmodule.c:201:12: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcpy(fnidx, inputfilename), ".px2"); data/python-pairix-0.3.7/src/pairixmodule.c:674: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(sname, chr1); data/python-pairix-0.3.7/src/pairixmodule.c:677: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(sname+h+1, chr2); data/python-pairix-0.3.7/src/pairixmodule.c:772: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(sname, chr1); data/python-pairix-0.3.7/src/pairixmodule.c:775: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(sname+h+1, chr2); data/python-pairix-0.3.7/src/pairs_merger.c:32:8: [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(fn_list[i],argv[i+1]); data/python-pairix-0.3.7/src/streamer_1d.c:30: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(fn,argv[1]); data/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/knetfile.c:389: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/python-pairix-0.3.7/src/main.c:121:17: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long(argc, argv, "Lp:s:b:e:0S:c:lhHfr:d:u:v:Tnw:aWBY", long_options, &option_index)) >= 0) { data/python-pairix-0.3.7/src/bedidx.c:120: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/python-pairix-0.3.7/src/bedidx.c:123: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/python-pairix-0.3.7/src/bgzf.c:53: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/python-pairix-0.3.7/src/bgzf.c:147: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/python-pairix-0.3.7/src/bgzf.c:182: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(buffer, g_magic, BLOCK_HEADER_LENGTH); // the last two bytes are a place holder for the length of the block data/python-pairix-0.3.7/src/bgzf.c:228: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->uncompressed_block + input_length, remaining); data/python-pairix-0.3.7/src/bgzf.c:291: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_BLOCK_SIZE); data/python-pairix-0.3.7/src/bgzf.c:320: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_BLOCK_SIZE); data/python-pairix-0.3.7/src/bgzf.c:368: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/python-pairix-0.3.7/src/bgzf.c:400: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/python-pairix-0.3.7/src/bgzf.c:445: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/python-pairix-0.3.7/src/bgzf.c:564: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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/index.c:262:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char sname_double[strlen(str->s)+1]; data/python-pairix-0.3.7/src/index.c:500: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(x, &idx->conf, 40); data/python-pairix-0.3.7/src/index.c:569: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[8]; data/python-pairix-0.3.7/src/index.c:707: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/python-pairix-0.3.7/src/index.c:730: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), ".px2"); data/python-pairix-0.3.7/src/index.c:787: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, ".px2"); data/python-pairix-0.3.7/src/index.c:841: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/python-pairix-0.3.7/src/index.c:844: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/python-pairix-0.3.7/src/index.c:922:15: [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/python-pairix-0.3.7/src/index.c:925: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/python-pairix-0.3.7/src/index.c:936: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). *begin2 = atoi(p); data/python-pairix-0.3.7/src/index.c:939: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). *end2 = atoi(p); data/python-pairix-0.3.7/src/index.c:1358:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char namepair[1000], *str_ptr; data/python-pairix-0.3.7/src/index.c:1408:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char namepair[1000], *str_ptr; data/python-pairix-0.3.7/src/index.c:1624:7: [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), ".px2"); data/python-pairix-0.3.7/src/index.c:1828:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *seq1_list[n_seqpair_list]; data/python-pairix-0.3.7/src/knetfile.c:178: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/python-pairix-0.3.7/src/knetfile.c:252: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/python-pairix-0.3.7/src/knetfile.c:260: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/python-pairix-0.3.7/src/knetfile.c:265: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/python-pairix-0.3.7/src/knetfile.c:266: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/python-pairix-0.3.7/src/knetfile.c:345: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/python-pairix-0.3.7/src/knetfile.c:347: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/python-pairix-0.3.7/src/knetfile.c:349: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/python-pairix-0.3.7/src/knetfile.c:351: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/python-pairix-0.3.7/src/knetfile.c:416: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/python-pairix-0.3.7/src/knetfile.c:417: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/python-pairix-0.3.7/src/knetfile.c:478: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/python-pairix-0.3.7/src/knetfile.c:480: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/python-pairix-0.3.7/src/kseq.h:127: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/python-pairix-0.3.7/src/main.c:56: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(header,"r"); data/python-pairix-0.3.7/src/main.c:111: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 line[MAX_REGIONLINE_LEN]; data/python-pairix-0.3.7/src/main.c:126: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 'S': skip = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:142: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 's': conf.sc = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:143:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). case 'd': conf.sc2 = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:144: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 'b': conf.bc = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:145: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 'e': conf.ec = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:146:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). case 'u': conf.bc2 = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:147:34: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). case 'v': conf.ec2 = atoi(optarg); break; data/python-pairix-0.3.7/src/main.c:298:5: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(strcpy(fnidx, argv[optind]), ".px2"); data/python-pairix-0.3.7/src/main.c:411:32: [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(argv[i],"r"); data/python-pairix-0.3.7/src/pairixmodule.c:201:5: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(strcpy(fnidx, inputfilename), ".px2"); data/python-pairix-0.3.7/src/pairs_merger.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 *fn_list[num_fn]; data/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/index.c:262: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). char sname_double[strlen(str->s)+1]; data/python-pairix-0.3.7/src/index.c:276:42: [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_ptr = sname_double+strlen(sname_double); data/python-pairix-0.3.7/src/index.c:511:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l += strlen(name[i]) + 1; data/python-pairix-0.3.7/src/index.c:515:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). bgzf_write(fp, name[i], strlen(name[i]) + 1); data/python-pairix-0.3.7/src/index.c:698: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/python-pairix-0.3.7/src/index.c:729: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/python-pairix-0.3.7/src/index.c:733: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/python-pairix-0.3.7/src/index.c:786: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/python-pairix-0.3.7/src/index.c:824: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/python-pairix-0.3.7/src/index.c:866: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/python-pairix-0.3.7/src/index.c:906: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). h=strlen(sname); data/python-pairix-0.3.7/src/index.c:1225: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). regions[i] = malloc((strlen(chr1list[i]) + strlen(chr2) + 2) * sizeof(char)); data/python-pairix-0.3.7/src/index.c:1225:56: [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). regions[i] = malloc((strlen(chr1list[i]) + strlen(chr2) + 2) * sizeof(char)); data/python-pairix-0.3.7/src/index.c:1227:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(regions[i] + strlen(regions[i]) + 1) = 0; data/python-pairix-0.3.7/src/index.c:1228:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(regions[i] + strlen(regions[i])) = region_split_character; data/python-pairix-0.3.7/src/index.c:1241: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). } else if(strlen(sp) == 2 && sp[1]=='*'){ // 'c:s-e|*' data/python-pairix-0.3.7/src/index.c:1253: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). regions[i] = malloc((strlen(chr2list[i]) + strlen(chr1) + 2) * sizeof(char)); data/python-pairix-0.3.7/src/index.c:1253:56: [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). regions[i] = malloc((strlen(chr2list[i]) + strlen(chr1) + 2) * sizeof(char)); data/python-pairix-0.3.7/src/index.c:1255:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(regions[i] + strlen(regions[i]) + 1) = 0; data/python-pairix-0.3.7/src/index.c:1256:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(regions[i] + strlen(regions[i])) = region_split_character; data/python-pairix-0.3.7/src/index.c:1362: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). str_ptr = namepair + strlen(namepair); data/python-pairix-0.3.7/src/index.c:1412: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). str_ptr = namepair + strlen(namepair); data/python-pairix-0.3.7/src/index.c:1623:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *fnidx = calloc(strlen(fn) + 5, 1); data/python-pairix-0.3.7/src/index.c:1696:31: [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). sublist[k] = malloc((strlen(b_split+1)+1)*sizeof(char)); data/python-pairix-0.3.7/src/index.c:1731:31: [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). sublist[k] = malloc((strlen(seqpair_list[i])+1)*sizeof(char)); data/python-pairix-0.3.7/src/index.c:1745:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l = strlen(s); data/python-pairix-0.3.7/src/index.c:1839: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). seq1_list[i] = malloc((strlen(seqpair)+1)*sizeof(char)); data/python-pairix-0.3.7/src/index.c:1880: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). uniq_seq_list[0] = malloc((strlen(seq_list[0])+1)*sizeof(char)); data/python-pairix-0.3.7/src/index.c:1886: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). uniq_seq_list[k] = malloc((strlen(seq_list[i])+1)*sizeof(char)); data/python-pairix-0.3.7/src/knetfile.c:239: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/python-pairix-0.3.7/src/knetfile.c:312: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/python-pairix-0.3.7/src/knetfile.c:313: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/python-pairix-0.3.7/src/knetfile.c:315: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/python-pairix-0.3.7/src/knetfile.c:384: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/python-pairix-0.3.7/src/knetfile.c:522:11: [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/python-pairix-0.3.7/src/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/python-pairix-0.3.7/src/kstring.c:32: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/python-pairix-0.3.7/src/kstring.c:157: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). matches = ksBM_search(str, strlen(str), pat, strlen(pat), 0, &n); data/python-pairix-0.3.7/src/kstring.c:157:48: [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). matches = ksBM_search(str, strlen(str), pat, strlen(pat), 0, &n); data/python-pairix-0.3.7/src/kstring.h:38:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s->s + s->l, p, l); data/python-pairix-0.3.7/src/kstring.h:46: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/python-pairix-0.3.7/src/main.c:200: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). int l = strlen(argv[optind]); data/python-pairix-0.3.7/src/main.c:297:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *fnidx = calloc(strlen(argv[optind]) + 5, 1); data/python-pairix-0.3.7/src/main.c:414: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). line[strlen(line)-1]=0; // trim '\n' data/python-pairix-0.3.7/src/pairixmodule.c:200:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *fnidx = calloc(strlen(inputfilename) + 5, 1); data/python-pairix-0.3.7/src/pairixmodule.c:215:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int l = strlen(inputfilename); data/python-pairix-0.3.7/src/pairixmodule.c:673: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). sname = (char*)malloc(strlen(chr1)+strlen(chr2)+2); data/python-pairix-0.3.7/src/pairixmodule.c:673: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). sname = (char*)malloc(strlen(chr1)+strlen(chr2)+2); data/python-pairix-0.3.7/src/pairixmodule.c:675:7: [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=strlen(sname); data/python-pairix-0.3.7/src/pairixmodule.c:771: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). sname = (char*)malloc(strlen(chr1)+strlen(chr2)+2); data/python-pairix-0.3.7/src/pairixmodule.c:771: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). sname = (char*)malloc(strlen(chr1)+strlen(chr2)+2); data/python-pairix-0.3.7/src/pairixmodule.c:773:7: [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=strlen(sname); ANALYSIS SUMMARY: Hits = 158 Lines analyzed = 7140 in approximately 0.31 seconds (23008 lines/second) Physical Source Lines of Code (SLOC) = 5554 Hits@level = [0] 147 [1] 56 [2] 61 [3] 3 [4] 38 [5] 0 Hits@level+ = [0+] 305 [1+] 158 [2+] 102 [3+] 41 [4+] 38 [5+] 0 Hits/KSLOC@level+ = [0+] 54.9154 [1+] 28.448 [2+] 18.3651 [3+] 7.38207 [4+] 6.84192 [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.